This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_platform test_mac_ver fails on Darwin x86_64
Type: Stage: resolved
Components: macOS Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: davide.rizzo, ned.deily, python-dev, ronaldoussoren
Priority: normal Keywords:

Created on 2011-07-13 09:49 by davide.rizzo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg140241 - (view) Author: Davide Rizzo (davide.rizzo) * Date: 2011-07-13 09:49
test test_platform failed -- Traceback (most recent call last):
  File "/Users/davide/cpython/Lib/test/test_platform.py", line 194, in test_mac_ver
    self.assertEqual(res[2], 'i386')
AssertionError: 'x86_64' != 'i386'
- x86_64
+ i386


uname reports machine as "x86_64", but the test expects "i386".

Related: the Gestalt call makes no difference between i386 and x86_64 and may only return "i386" as the machine.
msg140295 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-07-13 18:52
What version of OS X are you running this on?  10.7 perhaps?  AFAIK, uname has always reported 'i386' for Intel machines.
msg140296 - (view) Author: Davide Rizzo (davide.rizzo) * Date: 2011-07-13 19:40
No, it's 10.6.8. Now that I think of it I updated from 10.6.7
recently. But I have no 10.6.7 x86_64 bit machine where to test.
msg140302 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-07-13 20:25
I have never seen this failure on any Apple x86_64 running 10.x including 10.6.8.  Could you please report what Mac model you are running on and the output from running the following:

$ uname -m
$ /path/to/your/python
Python 3.2.1 (v3.2.1:ac1f7e5c0510, Jul  9 2011, 01:03:53) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxsize
9223372036854775807
>>> import platform
>>> platform.mac_ver()
('10.6.8', ('', '', ''), 'i386')
>>> platform._mac_ver_xml()
('10.6.8', ('', '', ''), 'i386')
>>> platform._mac_ver_gestalt()  # a bug!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/platform.py", line 761, in _mac_ver_gestalt
    return release,versioninfo,machine
>>> import os
>>> os.uname()
('Darwin', 'fimt.baybryj.net', '10.8.0', 'Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386', 'i386')

Thanks!
msg140305 - (view) Author: Davide Rizzo (davide.rizzo) * Date: 2011-07-13 20:51
I first saw it failing on 3.3 while testing for another bug, then run the test on other versions including 2.7 and it always fails. System Python 2.6 does NOT fail, but it has no _mac_ver_xml().

This is a MacBook Pro 13" with Intel Core i5.

--------------------
$ uname -m
x86_64
$ ./python.exe 
Python 3.3.0a0 (default:e0cd35660ae9, Jul 13 2011, 11:02:57) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
[63386 refs]
>>> sys.maxsize
9223372036854775807
[63389 refs]
>>> import platform
[65649 refs]
>>> platform.mac_ver()
('10.6.8', ('', '', ''), 'x86_64')
[69688 refs]
>>> platform._mac_ver_xml()
('10.6.8', ('', '', ''), 'x86_64')
[69733 refs]
>>> platform._mac_ver_gestalt()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/davide/cpython/Lib/platform.py", line 682, in _mac_ver_gestalt
    return release,versioninfo,machine
NameError: global name 'versioninfo' is not defined
[69809 refs]
>>> import os
[69811 refs]
>>> os.uname()
('Darwin', 'Brude.local', '10.8.0', 'Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64', 'x86_64')
[69814 refs]

--------------------



The following is with System Python 2.6 on the same OS:
--------------------
Python 2.6.1 (r261:67515, Aug  2 2010, 20:10:18) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.mac_ver()
('10.6.8', ('', '', ''), 'i386')
>>> import sys
>>> sys.maxsize
9223372036854775807

--------------------


Then Python 2.7 from www.python.org:
--------------------
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxsize
9223372036854775807
>>> import platform
>>> platform.mac_ver()
('10.6.8', ('', '', ''), 'x86_64')
>>> platform._mac_ver_xml()
('10.6.8', ('', '', ''), 'x86_64')
>>> platform._mac_ver_gestalt()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.py", line 768, in _mac_ver_gestalt
    return release,versioninfo,machine
NameError: global name 'versioninfo' is not defined

--------------------

If you need any more info feel free to ask.
msg140306 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-07-13 20:57
Thanks for running that.  I guess the significant difference is having an i5 processor.  We'll need to fix it.
msg140312 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-07-13 22:10
New changeset 0a53a978a160 by Ned Deily in branch '2.7':
Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64'
http://hg.python.org/cpython/rev/0a53a978a160

New changeset d050c8c9a3b3 by Ned Deily in branch '3.2':
Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64'
http://hg.python.org/cpython/rev/d050c8c9a3b3

New changeset 0025ce38fbd0 by Ned Deily in branch 'default':
Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64'
http://hg.python.org/cpython/rev/0025ce38fbd0
History
Date User Action Args
2022-04-11 14:57:19adminsetgithub: 56758
2011-07-13 22:13:12ned.deilysetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2011-07-13 22:10:36python-devsetnosy: + python-dev
messages: + msg140312
2011-07-13 20:57:15ned.deilysetassignee: ronaldoussoren -> ned.deily
messages: + msg140306
stage: needs patch
2011-07-13 20:51:47davide.rizzosetmessages: + msg140305
2011-07-13 20:25:46ned.deilysetmessages: + msg140302
2011-07-13 19:40:30davide.rizzosetmessages: + msg140296
2011-07-13 18:52:13ned.deilysetnosy: + ned.deily
messages: + msg140295
2011-07-13 09:49:23davide.rizzocreate