From: Steve Dower Date: Thu, 9 Jul 2020 17:52:43 +0000 (+0100) Subject: bpo-41172: Fix check for compiler in test suite (GH-21400) X-Git-Tag: v3.10.0a1~414 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af56c4fc76ac39ce76d649d7bebf7f78c1add4fa;p=thirdparty%2FPython%2Fcpython.git bpo-41172: Fix check for compiler in test suite (GH-21400) --- diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index f8f60fb6c27b..b21978a61cd2 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