diff options
Diffstat (limited to 'Lib/sysconfig.py')
-rw-r--r-- | Lib/sysconfig.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index d38974c..8ec399c 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -680,13 +680,16 @@ def get_platform(): # behaviour. pass else: - m = re.search( - r'<key>ProductUserVisibleVersion</key>\s*' + - r'<string>(.*?)</string>', f.read()) - f.close() - if m is not None: - macrelease = '.'.join(m.group(1).split('.')[:2]) - # else: fall back to the default behaviour + try: + m = re.search( + r'<key>ProductUserVisibleVersion</key>\s*' + + r'<string>(.*?)</string>', f.read()) + f.close() + if m is not None: + macrelease = '.'.join(m.group(1).split('.')[:2]) + # else: fall back to the default behaviour + finally: + f.close() if not macver: macver = macrelease |