8000 bpo-35952: Fix test.pythoninfo when the compiler is missing (GH-13007) · python/cpython@a86e064 · GitHub
[go: up one dir, main page]

Skip to content

Commit a86e064

Browse files
xdegayevstinner
authored andcommitted
bpo-35952: Fix test.pythoninfo when the compiler is missing (GH-13007)
1 parent 843bf42 commit a86e064

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Lib/test/pythoninfo.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,17 @@ def collect_cc(info_add):
571571
except ImportError:
572572
args = CC.split()
573573
args.append('--version')
574-
proc = subprocess.Popen(args,
575-
stdout=subprocess.PIPE,
576-
stderr=subprocess.STDOUT,
577-
universal_newlines=True)
574+
try:
575+
proc = subprocess.Popen(args,
576+
stdout=subprocess.PIPE,
577+
stderr=subprocess.STDOUT,
578+
universal_newlines=True)
579+
except OSError:
580+
# Cannot run the compiler, for example when Python has been
581+
# cross-compiled and installed on the target platform where the
582+
# compiler is missing.
583+
return
584+
578585
stdout = proc.communicate()[0]
579586
if proc.returncode:
580587
# CC --version failed: ignore error
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix pythoninfo when the compiler is missing.

0 commit comments

Comments
 (0)
0