summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-07-09 18:12:07 (GMT)
committerGitHub <noreply@github.com>2020-07-09 18:12:07 (GMT)
commitc65ee555124a5647b8e3a5d58c906fa5db9e927a (patch)
treeac234d654f84bfbc49c617c2add7ea03cfcc390a /Lib
parentb4beda1a865972dc6477fd84b1a96ff5ccbfb45a (diff)
downloadcpython-c65ee555124a5647b8e3a5d58c906fa5db9e927a.zip
cpython-c65ee555124a5647b8e3a5d58c906fa5db9e927a.tar.gz
cpython-c65ee555124a5647b8e3a5d58c906fa5db9e927a.tar.bz2
bpo-41172: Fix check for compiler in test suite (GH-21400)
(cherry picked from commit af56c4fc76ac39ce76d649d7bebf7f78c1add4fa) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/support/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 19d52fd..aee3737 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -2733,9 +2733,15 @@ def missing_compiler_executable(cmd_names=[]):
missing.
"""
- from distutils import ccompiler, sysconfig, spawn
+ from distutils import ccompiler, sysconfig, spawn, errors
compiler = ccompiler.new_compiler()
sysconfig.customize_compiler(compiler)
+ if compiler.compiler_type == "msvc":
+ # MSVC has no executables, so check whether initialization succeeds
+ try:
+ compiler.initialize()
+ except errors.DistutilsPlatformError:
+ return "msvc"
for name in compiler.executables:
if cmd_names and name not in cmd_names:
continue