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

> IMHO platform.architecture() should return 32bit when running "arch -i386 
> /usr/local/bin/python3" to be consistent with struct.calcsize("P") == 4 and 
> sys.maxsize == 2147483647. Otherwise, how would you notice that you are using 
> the 32-bit flavor of Python?

I don't agree. Platform.architecture() is defined to look at a specified 
binary, not the currently running process. That can lead to inconsistencies 
like this and is not something you can avoid. 


> Ronald Oussoren:
> > 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.

> Right, but I don't think that it's possible to report that Python executable 
> is FAT binary in platform.architecture() result. If you want to provide such 
> information, IMHO you should write a new function or at least add a new 
> parameter to platform.architecture().

> IMHO it's more consistent to report "32bit" for "arch -i386 python3" and 
> "64bit" for "arch -x86_64 python3".

This doesn't necessarily need a new function, platform.architecture could also 
return something like "32bit,64bit". 

But as I mentioned in my previous message I don't know why anyone would want to 
use this function in the first place. There are better ways to determine 
information about the current process (struct.calcsize, sys.maxsize, 
sys.byteorder), and I have never had a need to determine information about 
executable files that I couldn't get in a better way using other libraries 
(like macholib and pyelftools)

----------

_______________________________________
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