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 efc782d

Browse filesBrowse files
bpo-40459: Fix NameError in platform.py (GH-19855)
(cherry picked from commit 1e7e451) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
1 parent 70fe95c commit efc782d
Copy full SHA for efc782d

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
@@ -395,9 +395,9 @@ def win32_ver(release='', version='', csd='', ptype=''):
395395
else:
396396
try:
397397
cvkey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
398-
with winreg.OpenKeyEx(HKEY_LOCAL_MACHINE, cvkey) as key:
399-
ptype = QueryValueEx(key, 'CurrentType')[0]
400-
except:
398+
with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, cvkey) as key:
399+
ptype = winreg.QueryValueEx(key, 'CurrentType')[0]
400+
except OSError:
401401
pass
402402

403403
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.