From 05927a66a778a8a58ac794e0239d076acb30a6a3 Mon Sep 17 00:00:00 2001 From: Michael Osthege Date: Sat, 9 Jul 2022 18:40:02 +0200 Subject: BUG: Use `Popen` to silently invoke f77 -v The output analyzed by this function unexpectedly ended up in stderr. Closes #21942 --- numpy/distutils/fcompiler/gnu.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'numpy/distutils') diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index d8143328e..cdb6aef94 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -382,7 +382,13 @@ class Gnu95FCompiler(GnuFCompiler): def get_target(self): try: - output = subprocess.check_output(self.compiler_f77 + ['-v']) + p = subprocess.Popen( + self.compiler_f77 + ['-v'], + stdin=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + stdout, stderr = p.communicate() + output = (stdout or b"") + (stderr or b"") except (OSError, subprocess.CalledProcessError): pass else: -- cgit v1.2.1