summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-10-05 17:35:19 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-10-05 17:35:19 (GMT)
commitf536386ca95ccd2f6798435887ffb0a137d8359e (patch)
tree55f12fa1267043898cc2512e11ce391aafd91038 /Lib/distutils
parent3074c134a9ebc590a998efa63641164469fa6776 (diff)
parentf0ccf02e5609890ffb1f928e1a1f74ebde1b5af7 (diff)
downloadcpython-f536386ca95ccd2f6798435887ffb0a137d8359e.zip
cpython-f536386ca95ccd2f6798435887ffb0a137d8359e.tar.gz
cpython-f536386ca95ccd2f6798435887ffb0a137d8359e.tar.bz2
Issue #25316: distutils raises OSError instead of DistutilsPlatformError when MSVC is not installed.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/_msvccompiler.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py
index 03a5f10..10a9ffd 100644
--- a/Lib/distutils/_msvccompiler.py
+++ b/Lib/distutils/_msvccompiler.py
@@ -28,15 +28,17 @@ import winreg
from itertools import count
def _find_vcvarsall(plat_spec):
- with winreg.OpenKeyEx(
- winreg.HKEY_LOCAL_MACHINE,
- r"Software\Microsoft\VisualStudio\SxS\VC7",
- access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY
- ) as key:
- if not key:
- log.debug("Visual C++ is not registered")
- return None, None
+ try:
+ key = winreg.OpenKeyEx(
+ winreg.HKEY_LOCAL_MACHINE,
+ r"Software\Microsoft\VisualStudio\SxS\VC7",
+ access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY
+ )
+ except OSError:
+ log.debug("Visual C++ is not registered")
+ return None, None
+ with key:
best_version = 0
best_dir = None
for i in count():