This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients scoder
Date 2011-10-15.13:30:37
SpamBayes Score 1.1726213e-06
Marked as misclassified No
Message-id <1318685438.52.0.865873705408.issue13186@psf.upfronthosting.co.za>
In-reply-to
Content
Starting at line 1223 in classobject.c, you can find this code:

    if (item == NULL)
        arg = PyInt_FromSsize_t(i);
    else
        arg = Py_BuildValue("(nO)", i, item);
    if (arg == NULL) {
        Py_DECREF(func);
        return -1;
    }
    res = PyEval_CallObject(func, arg);

If item is NULL, arg will be assigned an int object. Otherwise, it will receive a tuple. Only the second case works in the subsequent call to PyEval_CallObject(), i.e. arg must always be assigned an argument tuple.

A quick fix would be to call Py_BuildValue("(n)", i) in the first case. The code just did a getattr(), so this is not performance critical anymore.

I found this bug because the test_class.py test suite was failing in Cython.
History
Date User Action Args
2011-10-15 13:30:38scodersetrecipients: + scoder
2011-10-15 13:30:38scodersetmessageid: <1318685438.52.0.865873705408.issue13186@psf.upfronthosting.co.za>
2011-10-15 13:30:37scoderlinkissue13186 messages
2011-10-15 13:30:37scodercreate