diff options
author | xdegaye <xdegaye@gmail.com> | 2019-04-29 12:53:30 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-04-29 12:53:30 (GMT) |
commit | a86e06433a010f873dfd7957e0f87a39539876ee (patch) | |
tree | 7d73e0dfeea42cf5f1fe5cece5f57b41ae2f2b6b /Lib | |
parent | 843bf42aa65aaa25b356e7b3d8733a117b8f01a4 (diff) | |
download | cpython-a86e06433a010f873dfd7957e0f87a39539876ee.zip cpython-a86e06433a010f873dfd7957e0f87a39539876ee.tar.gz cpython-a86e06433a010f873dfd7957e0f87a39539876ee.tar.bz2 |
bpo-35952: Fix test.pythoninfo when the compiler is missing (GH-13007)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/pythoninfo.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index 19f274a..5809566 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -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 |