[New-bugs-announce] [issue10735] platform.architecture() gives misleading results for OS X multi-architecture executables
Ned Deily
report at bugs.python.org
Sun Dec 19 07:28:29 CET 2010
New submission from Ned Deily <nad at acm.org>:
OS X Mach-O universal executable files often contain multiple architectures including a combination of 32-bit and 64-bit archs, as with the newer OS X installer variants provided on python.org. In such cases, the platform.architecture() function always returns '64bit' as the bit architecture regardless of whether the interpreter is running in 32-bit or 64-bit mode. Thus, there is no documented way to reliably tell whether an interpreter is running in 32- or 64-bit in OS X. Instead of the platform module, one must resort to hacks like examining sys.maxsize (or sys.maxint) or checking type sizes from the struct module.
$ arch -x86_64 /usr/local/bin/python3.2 -c 'import sys,platform;
print(sys.maxsize,platform.architecture())'
9223372036854775807 ('64bit', '')
$ arch -i386 /usr/local/bin/python3.2 -c 'import sys,platform;
print(sys.maxsize,platform.architecture())'
2147483647 ('64bit', '')
----------
assignee: ronaldoussoren
components: Library (Lib), Macintosh
messages: 124331
nosy: ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: platform.architecture() gives misleading results for OS X multi-architecture executables
type: behavior
versions: Python 2.7, Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10735>
_______________________________________
More information about the New-bugs-announce
mailing list