On Fri, Apr 17, 2009 at 12:58 AM, Robert Bradshaw
<[email protected]> wrote:

>
> This will actually raise the wrong kind of error for non-int objects--
> perhaps we should just remove the entire line? Optimized setting/
> getting still happens with int indices.

Here's a patch that comments out the lines and adds a comment.

diff -r fc73225aaea1 Cython/Compiler/ExprNodes.py
--- a/Cython/Compiler/ExprNodes.py      Fri Apr 17 09:11:16 2009 +0200
+++ b/Cython/Compiler/ExprNodes.py      Fri Apr 17 11:37:44 2009 -0500
@@ -1856,8 +1856,12 @@
             index_code = self.index.py_result()
             if self.base.type is dict_type:
                 function = "PyDict_SetItem"
-            elif self.base.type is list_type:
-                function = "PyList_SetItem"
+            # PyList_SetItem() requires the index to be converted to a
+            # Py_ssize_t, so we fall through to PyObject_SetItem instead.
+            #
+            #elif self.base.type is list_type:
+            #    function = "PyList_SetItem"
+
             # don't use PyTuple_SetItem(), as we'd normally get a
             # TypeError when changing a tuple, while PyTuple_SetItem()
             # would allow updates

Kurt
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to