Issue 7146: platform.uname()[4] returns 'amd64' on Windows and 'x86-64' on Linux (original) (raw)

Created on 2009-10-15 23:40 by zooko, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg94112 - (view) Author: Zooko O'Whielacronx (zooko) Date: 2009-10-15 23:40
Looking at http://bugs.python.org/setuptools/issue1 and reading the source of Lib/platform.py, it appears to me that uname() returns different strings identifying the amd64 architecture depending on what operating system is running. It would seem to me that it would be better to report the same arch with the same string on all platforms. Could someone with win64 report the output of: python -c 'import platform;print platform.uname()[4]' Here is a patch against trunk that just replaces any 'x86_64' with 'amd64': HACK yukyuk:~/playground/python/trunk$ svn diff Index: Lib/platform.py =================================================================== --- Lib/platform.py (revision 75443) +++ Lib/platform.py (working copy) @@ -1225,6 +1225,9 @@ system = 'Windows' release = 'Vista' + # normalize 'amd64' arch + if machine == 'x86_64': + machine = 'amd64' _uname_cache = system,node,release,version,machine,processor return _uname_cache
msg94134 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2009-10-16 10:23
Zooko O'Whielacronx wrote: > > > > Looking at http://bugs.python.org/setuptools/issue1 and reading the > > source of Lib/platform.py, it appears to me that uname() returns > > different strings identifying the amd64 architecture depending on what > > operating system is running. It would seem to me that it would be > > better to report the same arch with the same string on all platforms. platform.py generally follows (or tries to follow) the standards for naming things on each platform. It does not try to streamline naming standards across various OSes and platforms. For 64-bit x86 compatible platforms, the names "x86_64", "amd64" and "x64" are in common use. Since the proposal relates to setuptools, I'd suggest to do any such streamlining there, if needed and found necessary. For matching a binary to a system configuration you only to need to make sure that the name used for that particular system is the same. Since os.uname() does not exist on Windows, platform.uname() can be used for this purpose. What we could do is add a new API that returns canonical names for the various platforms. That function could then return "amd64" for AMD 64-bit architecture compatible processors. I'm also thinking about adding a function to do platform matching to platform.py: the function would take two uname() results (or part thereof) and return True/False depending on whether the platforms are binary compatible or not. Some background on the used 64-bit platform names: MS started out with calling the 64-bit x86 compatible processors "AMD64" and used "IA64" for the Itanium processor family. More recently they switched to calling 64-bit versions "x64" and since support for the Itanium processor family is being phased out this will soon become the only name used for the 64-bit version of Windows. Cygwin on Windows uses "x86_64", FreeBSD uses "amd64", Linux uses "x86_64". Mac OS X uses "x86_64" for Intels (and "ppc64" for PowerPCs). Resources: http://www.stata.com/support/faqs/win/64bit.html http://www.microsoft.com/servers/64bit/overview.mspx http://www.cygwin.com/ml/cygwin/2005-10/msg00688.html http://en.wikipedia.org/wiki/X86-64
msg94280 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-20 14:47
x86-64 is now the common name for the 64-bit instruction set implemented by mainstream AMD and Intel processors. Even on the AMD web site, "x86-64" shows up more often than "AMD64" (says Google).
msg94299 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-10-20 20:59
I'm not sure that changing this would do any good. Applications may rely on the status quo, so I fail to see the point in breaking them.
msg189620 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2013-05-19 19:46
It appears from previous comments that this is not needed so can be closed.
msg189623 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-05-19 20:17
Right, Marc-Andre indicates that cross-platform consistency is not a goal of the platform uname. If someone wants to propose a patch for the possible enhancement to platform that Marc-Andre talked about, they can open a new issue.
History
Date User Action Args
2022-04-11 14:56:54 admin set github: 51395
2013-05-19 20:17:18 r.david.murray set status: open -> closedtype: behaviortitle: [PATCH] platform.uname()[4] returns 'amd64' on Windows and 'x86-64' on Linux -> platform.uname()[4] returns 'amd64' on Windows and 'x86-64' on Linuxnosy: + r.david.murraymessages: + resolution: not a bugstage: resolved
2013-05-19 19:46:21 BreamoreBoy set nosy: + BreamoreBoymessages: +
2009-10-20 20:59:32 loewis set messages: +
2009-10-20 14:47:00 pitrou set nosy: + pitroumessages: +
2009-10-16 10:23:25 lemburg set messages: +
2009-10-15 23:56:58 pjenvey set nosy: + lemburg, loewis
2009-10-15 23:40:51 zooko create