Ronald Oussoren <ronaldousso...@mac.com> added the comment:

BTW. A related problem with platform.architecture() is that it doesn't know how 
to deal with fat binaries (such as those found on macOS).

As an example:

$  file /usr/bin/python
/usr/bin/python: Mach-O universal binary with 2 architectures: [i386:Mach-O 
executable i386] [x86_64:Mach-O 64-bit executable x86_64]
/usr/bin/python (for architecture i386):        Mach-O executable i386
/usr/bin/python (for architecture x86_64):      Mach-O 64-bit executable x86_64

This will be reported as "64-bit" by platform.architecture() because there is 
'64-bit' in the output of file(1).

Using sizeof(void*) or sys.maxsize suffers from the a simular problem: this 
will only detect the pointer-size of the current proces and not that the binary 
is capable of running with a different pointer-size as well. 

P.S. platform.architecture() uses file(1) because you can specify different 
executables than sys.executable.

----------
nosy: +ronaldoussoren

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35348>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to