New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"cdef list" variable generates incorrect PyList_SetItem code #844
Comments
scoder changed description from The first function below "in_range" works fine (the last line
Compiling raises a warning, as it should:
And calling it raises the exception:
This can be fixed easily with a wrapper around the index variable in the PyList_SetItem generated code in ExprNodes.py:generate_setitem_code to The first function below "in_range" works fine (the last line
Compiling raises a warning, as it should:
And calling it raises the exception:
This can be fixed easily with a wrapper around the index variable in the Clearly a bug, looks like we need to coerce the index to Py_ssize_t first. |
@robertwb commented Coercing to a Py_ssize_t will raise the wrong kind of exception. |
@robertwb changed owner from http://hg.cython.org/cython-devel/rev/06317e2576e8 |
@robertwb changed resolution to |
The first function below "in_range" works fine (the last line
generates a call to
PyObject_SetItem
) but the "out_of_range" function does not. The last line in it generates a call toPyList_SetItem
as it should, but the 'ob'PyObject
is not converted to aPy_ssize_t
.Compiling raises a warning, as it should:
And calling it raises the exception:
This can be fixed easily with a wrapper around the index variable in the
PyList_SetItem
generated code inExprNodes.py:generate_setitem_code
Migrated from http://trac.cython.org/ticket/284
The text was updated successfully, but these errors were encountered: