[Python-Dev] ssize_t question: longs in header files (original) (raw)

Tim Peters tim.peters at gmail.com
Mon May 29 19:46:14 CEST 2006


[Neal Norwitz]

* hash values Include/abstract.h: long PyObjectHash(PyObject *o); // also in object.h Include/object.h:typedef long (*hashfunc)(PyObject *);

We should leave these alone for now. There's no real connection between the width of a hash value and the number of elements in a container, and Py_ssize_t is conceptually only related to the latter.

As you noted later, there is an unusually strong connection in the dict implementation, and it's been on my todo list for months to look into that. Certainly the struct _dictobject members need to change from int to Py_ssize_t (including ma_mask), but that can't be done mechanically (code changes may also be required, and this is one is much more math- than compiler-warning- driven).

I'll note in passing that the debug-build obmalloc has no idea what to do with byte counts that don't fit in 4 bytes (it will probably left-truncate them in its internal debugging records).



More information about the Python-Dev mailing list