Skip to content

Commit af56c4f

Browse files
authored
bpo-41172: Fix check for compiler in test suite (GH-21400)
1 parent 8b33961 commit af56c4f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/support/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,9 +1673,15 @@ def missing_compiler_executable(cmd_names=[]):
16731673
missing.
16741674
16751675
"""
1676-
from distutils import ccompiler, sysconfig, spawn
1676+
from distutils import ccompiler, sysconfig, spawn, errors
16771677
compiler = ccompiler.new_compiler()
16781678
sysconfig.customize_compiler(compiler)
1679+
if compiler.compiler_type == "msvc":
1680+
# MSVC has no executables, so check whether initialization succeeds
1681+
try:
1682+
compiler.initialize()
1683+
except errors.DistutilsPlatformError:
1684+
return "msvc"
16791685
for name in compiler.executables:
16801686
if cmd_names and name not in cmd_names:
16811687
continue

0 commit comments

Comments
 (0)