mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Bug fix for #780461: 'sysu' gestalt selector is meaningless on MacOSX,
but attempting to get it resulted in a crash. Fixed. Backport candidate.
This commit is contained in:
parent
5187a3bcdb
commit
a290e3d7c6
1 changed files with 3 additions and 1 deletions
|
@ -525,12 +525,13 @@ def win32_ver(release='',version='',csd='',ptype=''):
|
||||||
def _mac_ver_lookup(selectors,default=None):
|
def _mac_ver_lookup(selectors,default=None):
|
||||||
|
|
||||||
from gestalt import gestalt
|
from gestalt import gestalt
|
||||||
|
import MacOS
|
||||||
l = []
|
l = []
|
||||||
append = l.append
|
append = l.append
|
||||||
for selector in selectors:
|
for selector in selectors:
|
||||||
try:
|
try:
|
||||||
append(gestalt(selector))
|
append(gestalt(selector))
|
||||||
except RuntimeError:
|
except (RuntimeError, MacOS.Error):
|
||||||
append(default)
|
append(default)
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
@ -557,6 +558,7 @@ def mac_ver(release='',versioninfo=('','',''),machine=''):
|
||||||
# Check whether the version info module is available
|
# Check whether the version info module is available
|
||||||
try:
|
try:
|
||||||
import gestalt
|
import gestalt
|
||||||
|
import MacOS
|
||||||
except ImportError:
|
except ImportError:
|
||||||
return release,versioninfo,machine
|
return release,versioninfo,machine
|
||||||
# Get the infos
|
# Get the infos
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue