bpo-40459: Fix NameError in platform.py (GH-19855)

(cherry picked from commit 1e7e4519a8)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2020-05-04 19:51:48 -07:00 committed by GitHub
parent 70fe95cdc9
commit efc782d29e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -395,9 +395,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

View File

@ -0,0 +1 @@
:func:`platform.win32_ver` now produces correct *ptype* strings instead of empty strings.