New submission from Ned Deily <n...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue10735>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to