]> granicus.if.org Git - python/commitdiff
bpo-35952: Fix test.pythoninfo when the compiler is missing (GH-13007)
authorxdegaye <xdegaye@gmail.com>
Mon, 29 Apr 2019 12:53:30 +0000 (14:53 +0200)
committerVictor Stinner <vstinner@redhat.com>
Mon, 29 Apr 2019 12:53:30 +0000 (14:53 +0200)
Lib/test/pythoninfo.py
Misc/NEWS.d/next/Library/2019-04-29-11-47-06.bpo-35952.3uNuyo.rst [new file with mode: 0644]

index 19f274a6b6294b056aee287042d04e96e74a672b..580956633f4d40e57964fac40b5d8dd4c63b703c 100644 (file)
@@ -571,10 +571,17 @@ def collect_cc(info_add):
     except ImportError:
         args = CC.split()
     args.append('--version')
-    proc = subprocess.Popen(args,
-                            stdout=subprocess.PIPE,
-                            stderr=subprocess.STDOUT,
-                            universal_newlines=True)
+    try:
+        proc = subprocess.Popen(args,
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.STDOUT,
+                                universal_newlines=True)
+    except OSError:
+        # Cannot run the compiler, for example when Python has been
+        # cross-compiled and installed on the target platform where the
+        # compiler is missing.
+        return
+
     stdout = proc.communicate()[0]
     if proc.returncode:
         # CC --version failed: ignore error
diff --git a/Misc/NEWS.d/next/Library/2019-04-29-11-47-06.bpo-35952.3uNuyo.rst b/Misc/NEWS.d/next/Library/2019-04-29-11-47-06.bpo-35952.3uNuyo.rst
new file mode 100644 (file)
index 0000000..9aeea90
--- /dev/null
@@ -0,0 +1 @@
+Fix pythoninfo when the compiler is missing.