From c8c898cb82b88bddf91ef9f926db3177ecd39108 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 8 Jul 2020 19:40:43 +0100 Subject: [PATCH] bpo-41172: Fix check for compiler in test suite --- Lib/test/support/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index f8f60fb6c27b91..b21978a61cd2f1 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