[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

Michael Felt report at bugs.python.org
Tue Mar 1 08:59:27 EST 2016


Michael Felt added the comment:

while reading to learn...

FYI: AIX does not return even a hint of the underlying platform (assumption is probably 64-bit) - but the value of the interpreter is anyone's guess

root at x064:[/data/prj/aixtools/python/python-2.7.10]python
Python 2.7.10 (default, Mar  1 2016, 12:55:35) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils.util
>>> distutils.util.get_platform()
'aix-5.3'
>>> import os
>>> os.uname()
('AIX', 'x064', '3', '5', '00XXXXXXXXXX')


Going through the rest of the preceding messages:
a) platform.architecture() - seems accurate for AIX, is import so expensive that it is not preferred?
>>> import platform
>>> platform.architecture()
('32bit', '')

b) sys.maxsize < 2**16 is a good hint, but it is possible to have a 64-bit int with only 32-bit pointers - based on assumption!
>>> import os, sys
>>> sys.maxsize
2147483647
>>> 2**32
4294967296L
>>> 2**31
2147483648L

> If your wording is correct, and get_platform() really is used to determine "the
> python being used," then we could actually be improving things by fixing this.
> Currently, get_platform() doesn't tell you the bitness of the *python* being
> used, but the bitness of the *OS* being used (the two of which only differ on
> 32-on-64).

So, it seems get_platform() does not have a uniform result that could ever be parsed by internal or external modules. It is always dependent on something external to python (e.g., uname() output).

IMHO: determining and adding the python bitness, as MacOS has done (i.e., I assume it is either (32-bit) or (64-bit) at the end) is a move forward - and I would be willing to submit a couple of somethings so that that value could be determined - leave it to a committer to decide what makes best sense.

Of course, it is "sad" if it breaks existing things, but being non-uniform as it is worse (imho :smile:)

----------
nosy: +Michael.Felt

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


More information about the Python-bugs-list mailing list