[issue10735] platform.architecture() gives misleading results for OS X multi-architecture executables

Ronald Oussoren report at bugs.python.org
Sun Mar 13 12:58:55 CET 2011


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

W.r.t the MachO name: I misread the patch, MachO is fine as the name for the reasons you mention.

I'm not convinced that your hack to make bits return the pointer size of the currently running architecture when testing sys.executable is useful, especially because the behaviour is inconsistent (it doesn't work for other executables) and also does something different than the document behaviour.

I'd prefer to return all pointer sizes supported by the binary, even if that can be surprising for users not used to fat binaries. This can easily be accomplished by added the calculation of 'bits' to the elif branch below:

+ elif ('Mach-O executable' in fileout
+            or 'Mach-O 64-bit executable' in fileout):

Using sys.maxsize or struct.calcsize("P") are both good ways of determining the actual size, and if there is a real need we could add a function that explicitly returns the pointer size (although I don't think that such a function is really necessary).

----------

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


More information about the Python-bugs-list mailing list