Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS.Error for platform.mac_ver under OS X #38977

Closed
brettcannon opened this issue Jul 30, 2003 · 5 comments
Closed

MacOS.Error for platform.mac_ver under OS X #38977

brettcannon opened this issue Jul 30, 2003 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@brettcannon
Copy link
Member

BPO 780461
Nosy @malemburg, @brettcannon, @jackjansen

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/malemburg'
closed_at = <Date 2003-10-14.22:30:18.000>
created_at = <Date 2003-07-30.20:20:50.000>
labels = ['library']
title = 'MacOS.Error for platform.mac_ver under OS X'
updated_at = <Date 2003-10-14.22:30:18.000>
user = 'https://github.com/brettcannon'

bugs.python.org fields:

activity = <Date 2003-10-14.22:30:18.000>
actor = 'brett.cannon'
assignee = 'lemburg'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2003-07-30.20:20:50.000>
creator = 'brett.cannon'
dependencies = []
files = []
hgrepos = []
issue_num = 780461
keywords = []
message_count = 5.0
messages = ['17483', '17484', '17485', '17486', '17487']
nosy_count = 3.0
nosy_names = ['lemburg', 'brett.cannon', 'jackjansen']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue780461'
versions = ['Python 2.3']

@brettcannon
Copy link
Member Author

>>> platform.mac_ver()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Users/drifty/cvs_code/lib/python2.3/platform.py", 
line 563, in mac_ver
    sysv,sysu,sysa = _mac_ver_lookup(('sysv','sysu','sysa'))
  File "/Users/drifty/cvs_code/lib/python2.3/platform.py", 
line 532, in _mac_ver_lookup
    append(gestalt(selector))
MacOS.Error: (-5551, 'undefined selector was passed to 
Gestalt')

This is on an OS X 10.2.6 system.

Any chance this is because I compiled with --enable-
unicode=ucs4 ?

@brettcannon brettcannon added the stdlib Python modules in the Lib dir label Jul 30, 2003
@brettcannon brettcannon added the stdlib Python modules in the Lib dir label Jul 30, 2003
@jackjansen
Copy link
Member

Logged In: YES
user_id=45365

The problem is not with your ucs4 build, this call always fails
under MacOSX. The problem is that the 'sysu' gestalt selector isn't
available under OSX.

The code in _mac_ver_lookup does a try/except on RuntimeError
around the call to gestalt, but I don't remember MacOS.Error ever
being a subclass of RuntimeError. Currently MacOS.Error is in a
class by itself, it should probably be an OSError subclass, but that
still won't fix this.

I suggest doing the try/except on MacOS.Error.

@malemburg
Copy link
Member

Logged In: YES
user_id=38388

Catching MacOS.Error doesn't help much: if 'sysu' is not
available on MacOSX, then I need the system information
from somewhere else. Any hints ? (don't have a MacOSX
to test on, so it's up to you to provide the necessary
information or patch :-)

Thanks.

@brettcannon
Copy link
Member Author

Logged In: YES
user_id=357491

I have no clue how to get the info but I can help test anything. I
think Jack is going to have to be the big helper in terms of how to
patch this one.

@brettcannon
Copy link
Member Author

Logged In: YES
user_id=357491

Well, this is working for me under 2.4 (still busted under 2.3,
though). But a quick check of the cvs logs and it turns out Jack
wanted this backported but just didn't get to it.

So I will go ahead and backport the changes from 1.6 and 1.7 to
release23-maint.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

3 participants