Skip to content

Commit

Permalink
bpo-40459: Fix NameError in platform.py (GH-19855)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweeneyde authored May 5, 2020
1 parent 92a98ed commit 1e7e451
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,9 @@ def win32_ver(release='', version='', csd='', ptype=''):
else:
try:
cvkey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
with winreg.OpenKeyEx(HKEY_LOCAL_MACHINE, cvkey) as key:
ptype = QueryValueEx(key, 'CurrentType')[0]
except:
with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, cvkey) as key:
ptype = winreg.QueryValueEx(key, 'CurrentType')[0]
except OSError:
pass

return release, version, csd, ptype
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:func:`platform.win32_ver` now produces correct *ptype* strings instead of empty strings.

0 comments on commit 1e7e451

Please sign in to comment.