Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1e7e451

Browse filesBrowse files
authored
bpo-40459: Fix NameError in platform.py (GH-19855)
1 parent 92a98ed commit 1e7e451
Copy full SHA for 1e7e451

File tree

Expand file treeCollapse file tree

2 files changed

+4
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-3
lines changed

‎Lib/platform.py

Copy file name to clipboardExpand all lines: Lib/platform.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ def win32_ver(release='', version='', csd='', ptype=''):
398398
else:
399399
try:
400400
cvkey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
401-
with winreg.OpenKeyEx(HKEY_LOCAL_MACHINE, cvkey) as key:
402-
ptype = QueryValueEx(key, 'CurrentType')[0]
403-
except:
401+
with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, cvkey) as key:
402+
ptype = winreg.QueryValueEx(key, 'CurrentType')[0]
403+
except OSError:
404404
pass
405405

406406
return release, version, csd, ptype
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:func:`platform.win32_ver` now produces correct *ptype* strings instead of empty strings.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.