[Python-Dev] New PEP: Using ssize_t as the index type

Fredrik Lundh fredrik at pythonware.com
Thu Dec 29 23:22:32 CET 2005


Martin v. Löwis wrote:

> Please let me know what you think.

+1.  in honor of the Bike Shed Effect, I'm going to assume that you've
thought of everything.

:::

well, one thing seems to missing from your PEP: in several modules, you've
changed the cast used in the type table. e.g.

--- python/branches/ssize_t/Modules/_elementtree.c (original)
+++ python/branches/ssize_t/Modules/_elementtree.c Tue Dec 20 09:52:16 2005
@@ -1228,7 +1228,7 @@
 }

 static int
-element_setitem(ElementObject* self, size_t index, PyObject* item)
+element_setitem(ElementObject* self, Py_ssize_t index, PyObject* item)
 {
     int i;
     PyObject* old;
@@ -1373,7 +1373,7 @@
     0, /* sq_repeat */
     (ssizeargfunc) element_getitem,
     (ssizessizeargfunc) element_getslice,
-    (sizeobjargproc) element_setitem,
+    (ssizeobjargproc) element_setitem,
     (ssizessizeobjargproc) element_setslice,
 };

is this change backwards compatible ?

</F>





More information about the Python-Dev mailing list