[Python-checkins] bpo-40459: Fix NameError in platform.py (GH-19855)
Miss Islington (bot)
webhook-mailer at python.org
Mon May 4 22:51:41 EDT 2020
https://github.com/python/cpython/commit/8ddf91543890e38c76aa0029482c6f5f5c444837
commit: 8ddf91543890e38c76aa0029482c6f5f5c444837
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-05-04T19:51:33-07:00
summary:
bpo-40459: Fix NameError in platform.py (GH-19855)
(cherry picked from commit 1e7e4519a8ddc2239101a0146d788c9161143a77)
Co-authored-by: Dennis Sweeney <36520290+sweeneyde at users.noreply.github.com>
files:
A Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst
M Lib/platform.py
diff --git a/Lib/platform.py b/Lib/platform.py
index 6ab06b58321e0..7af46ffd17728 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -570,9 +570,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
diff --git a/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst b/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst
new file mode 100644
index 0000000000000..d4bf6987fa260
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-05-02-04-29-31.bpo-40459.fSAYVD.rst
@@ -0,0 +1 @@
+:func:`platform.win32_ver` now produces correct *ptype* strings instead of empty strings.
More information about the Python-checkins
mailing list