This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients cgohlke, python-dev, serhiy.storchaka, vstinner
Date 2013-09-05.07:12:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwbX+TU0XWvVzbEWWLMDhTtDDeWis0bPA-GkeH131qt2PA@mail.gmail.com>
In-reply-to <1378337754.24.0.619676159235.issue18909@psf.upfronthosting.co.za>
Content
2013/9/5 Christoph Gohlke <report@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)).
History
Date User Action Args
2013-09-05 07:12:35vstinnersetrecipients: + vstinner, cgohlke, python-dev, serhiy.storchaka
2013-09-05 07:12:35vstinnerlinkissue18909 messages
2013-09-05 07:12:35vstinnercreate