summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-10-22 12:21:58 -0600
committerGitHub <noreply@github.com>2021-10-22 12:21:58 -0600
commitff84c67ca41df34345203ab69c8f7819573d7811 (patch)
treed046f73d66098ad676ec09c265b20a7d266954f2
parent53d2a831668a58aa069e3bd891dd9d342dd058b3 (diff)
parent02f602b0fe4c5a67fe82f0cd7cb9c820392445f9 (diff)
downloadnumpy-ff84c67ca41df34345203ab69c8f7819573d7811.tar.gz
Merge pull request #20162 from matthew-brett/allow-gt-10-crt-ver
MRG: fixes for MSVC version checks
-rw-r--r--numpy/distutils/mingw32ccompiler.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
index c3a0cb418..82d296434 100644
--- a/numpy/distutils/mingw32ccompiler.py
+++ b/numpy/distutils/mingw32ccompiler.py
@@ -547,12 +547,12 @@ if sys.platform == 'win32':
# Value from msvcrt.CRT_ASSEMBLY_VERSION under Python 3.3.0
# on Windows XP:
_MSVCRVER_TO_FULLVER['100'] = "10.0.30319.460"
- # Python 3.7 uses 1415, but get_build_version returns 140 ??
- _MSVCRVER_TO_FULLVER['140'] = "14.15.26726.0"
- if hasattr(msvcrt, "CRT_ASSEMBLY_VERSION"):
- major, minor, rest = msvcrt.CRT_ASSEMBLY_VERSION.split(".", 2)
- _MSVCRVER_TO_FULLVER[major + minor] = msvcrt.CRT_ASSEMBLY_VERSION
- del major, minor, rest
+ crt_ver = getattr(msvcrt, 'CRT_ASSEMBLY_VERSION', None)
+ if crt_ver is not None: # Available at least back to Python 3.3
+ maj, min = re.match(r'(\d+)\.(\d)', crt_ver).groups()
+ _MSVCRVER_TO_FULLVER[maj + min] = crt_ver
+ del maj, min
+ del crt_ver
except ImportError:
# If we are here, means python was not built with MSVC. Not sure what
# to do in that case: manifest building will fail, but it should not be