Author ronaldoussoren
Recipients Windson Yang, lemburg, ronaldoussoren, serhiy.storchaka, vstinner
Date 2018-12-14.15:20:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544800837.91.0.788709270274.issue35348@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-12-14 15:20:37ronaldoussorensetrecipients: + ronaldoussoren, lemburg, vstinner, serhiy.storchaka, Windson Yang
2018-12-14 15:20:37ronaldoussorensetmessageid: <1544800837.91.0.788709270274.issue35348@psf.upfronthosting.co.za>
2018-12-14 15:20:37ronaldoussorenlinkissue35348 messages
2018-12-14 15:20:37ronaldoussorencreate