STINNER Victor added the comment: 2013/9/5 Christoph Gohlke <rep...@bugs.python.org>: > I am aware of two 3rd party C extensions that use the value of interpaddr(): > > https://github.com/python-imaging/Pillow/blob/master/_imagingtk.c#L40 > https://github.com/matplotlib/matplotlib/blob/master/src/_tkagg.cpp#L233 > > Both parse the PyObject returned by interpaddr() into a Py_ssize_t variable > using `PyArg_ParseTuple(PyObject*, "n", &Py_ssize_t)` and then cast the > Py_ssize_t variable to a (TkappObject*).
Ok, the code looks correct. Py_ssize_t is supposed to have the same size than a void*. > Can a PyLong with a value > 3**31 be parsed into a Py_ssize_t on 32 bit > platforms? Could this become a problem on systems where 32 bit processes can > address more than 2 GB? No, values >= 2^31 will raise an error. On Linux, addresses with the 32th bit set (range 0x80000000-0xffffffff) are reserved for the Linux kernel. So interpaddr() should be in the range 0x00000000-0x7fffffff. If the code worked before my patch, there is not reason for not working with the patch. My patch only has an impact on one specific platform: Windows 64 bit, the only platform where sizeof(long) < sizeof(void*) (on all other platforms supported by Python, sizeof(void*) == sizeof(long)). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18909> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com