-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Description
Bug report
Running x86 and AMD64 builds of Python 3.11.0 (official binary releases) in emulation on Windows 11 on an ARM64 machine gives me
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.machine()
'AMD64'
Python 3.11.0 (main, Oct 24 2022, 18:13:38) [MSC v.1933 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.machine()
'ARM64'
This seem inconsistent. I would expect both to return 'ARM64'
, the actual underlying processor architecture, in the same way as running an x86 build on AMD64 returns 'AMD64'
. But even if they were reporting the emulated architecture, it should be 'AMD64'
and 'x86'
, not 'AMD64'
and 'ARM64'
(or possibly 'AMD64'
and 'AMD64'
, if x86 binaries are also handled by the AMD64 emulator, I have no idea how that works).
This makes it hard to distinguish between an AMD64 build running on ARM64 and an AMD64 build running on AMD64. In fact, the only platform
function that gives any indication at all is processor()
, and parsing the desired information out of the free-form text returned by that seems fiddly. ('ARMv8 (64-bit) Family 8 Model 0 Revision 0, '
and 'Intel64 Family 6 Model 44 Stepping 2, GenuineIntel'
here.)
Relatedly, how do I distinguish between an ARM64 build running on ARM64 and an AMD64 build running on ARM64? The inconsistency above makes them differ in platform.machine()
, but what if that were fixed? This seems like a job for platform.architecture()
, which is explicitly meant to give information about the running binary, but that just returns ('64bit', 'WindowsPE')
in both cases. platform.python_compiler()
happens to have that information ('MSC v.1933 64 bit (ARM64)'
vs. 'MSC v.1933 64 bit (AMD64)'
), but again that is fiddly free-form text and may not work for other compilers than MSC.
Your environment
- CPython versions tested on: 3.11.0
- Operating system and architecture: Windows 11 10.0.22000 ARM64, Windows 10 10.0.19043 AMD64