Message145590
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. |
|
Date |
User |
Action |
Args |
2011-10-15 13:30:38 | scoder | set | recipients:
+ scoder |
2011-10-15 13:30:38 | scoder | set | messageid: <1318685438.52.0.865873705408.issue13186@psf.upfronthosting.co.za> |
2011-10-15 13:30:37 | scoder | link | issue13186 messages |
2011-10-15 13:30:37 | scoder | create | |
|