[issue22980] C extension naming doesn't take bitness into account

Marc-Andre Lemburg report at bugs.python.org
Tue Dec 2 18:32:06 CET 2014


Marc-Andre Lemburg added the comment:

Note that there's a difference between the platform's architecture (which is what get_platform() returns) and the pointer size of the currently running Python executable.

On 64-bit Linux, it's rather rare to have an application built as 32-bit executable. On 64-bit Windows, it's rather common to have 32-bit applications running.

The best way to determine 32-bit vs. 64-bit is by using the struct module:

    # Determine bitsize used by Python (not necessarily the same as
    # the one used by the platform)
    import struct
    bits = struct.calcsize('P') * 8

This should be portable across all platforms and will always refer to the pointer size of the currently running Python executable.

----------
nosy: +lemburg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22980>
_______________________________________


More information about the Python-bugs-list mailing list