diff options
author | Steve Dower <steve.dower@python.org> | 2020-07-09 17:52:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 17:52:43 (GMT) |
commit | af56c4fc76ac39ce76d649d7bebf7f78c1add4fa (patch) | |
tree | f93909724c327a96ad9140c0acdb8247cec0d66a /Lib/test/support | |
parent | 8b33961e4bc4020d8b2d5b949ad9d5c669300e89 (diff) | |
download | cpython-af56c4fc76ac39ce76d649d7bebf7f78c1add4fa.zip cpython-af56c4fc76ac39ce76d649d7bebf7f78c1add4fa.tar.gz cpython-af56c4fc76ac39ce76d649d7bebf7f78c1add4fa.tar.bz2 |
bpo-41172: Fix check for compiler in test suite (GH-21400)
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index f8f60fb..b21978a 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1673,9 +1673,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 |