diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-10-28 11:30:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-28 11:30:26 +0200 |
| commit | a8ebbd5fdb9df3d1d2885b24e783757d747dec8e (patch) | |
| tree | a1dc1bc4915e4231848553ea72dd1b4810a64786 /numpy/distutils | |
| parent | a10b20760610be8e820f695f9889060af1a640b9 (diff) | |
| parent | 69a39461de4da2bfc0e6aeeff02c73c0972a8614 (diff) | |
| download | numpy-a8ebbd5fdb9df3d1d2885b24e783757d747dec8e.tar.gz | |
Merge pull request #22483 from mwtoews/maint-subprocess
MAINT: change subprocess arguments from Python>=3.7
Diffstat (limited to 'numpy/distutils')
| -rw-r--r-- | numpy/distutils/ccompiler_opt.py | 2 | ||||
| -rw-r--r-- | numpy/distutils/exec_command.py | 7 | ||||
| -rw-r--r-- | numpy/distutils/lib2def.py | 2 | ||||
| -rw-r--r-- | numpy/distutils/misc_util.py | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py index 2019dcb25..5f18efc7d 100644 --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -747,7 +747,7 @@ class _Distutils: def _dist_test_spawn(cmd, display=None): try: o = subprocess.check_output(cmd, stderr=subprocess.STDOUT, - universal_newlines=True) + text=True) if o and re.match(_Distutils._dist_warn_regex, o): _Distutils.dist_error( "Flags in command", cmd ,"aren't supported by the compiler" diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py index 79998cf5d..a67453abf 100644 --- a/numpy/distutils/exec_command.py +++ b/numpy/distutils/exec_command.py @@ -276,14 +276,13 @@ def _exec_command(command, use_shell=None, use_tee = None, **env): # Inherit environment by default env = env or None try: - # universal_newlines is set to False so that communicate() + # text is set to False so that communicate() # will return bytes. We need to decode the output ourselves # so that Python will not raise a UnicodeDecodeError when # it encounters an invalid character; rather, we simply replace it - proc = subprocess.Popen(command, shell=use_shell, env=env, + proc = subprocess.Popen(command, shell=use_shell, env=env, text=False, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - universal_newlines=False) + stderr=subprocess.STDOUT) except OSError: # Return 127, as os.spawn*() and /bin/sh do return 127, '' diff --git a/numpy/distutils/lib2def.py b/numpy/distutils/lib2def.py index 820ed71f5..851682c63 100644 --- a/numpy/distutils/lib2def.py +++ b/numpy/distutils/lib2def.py @@ -64,7 +64,7 @@ def getnm(nm_cmd=['nm', '-Cs', 'python%s.lib' % py_ver], shell=True): nm_output = getnm(nm_cmd = 'nm -Cs py_lib')""" p = subprocess.Popen(nm_cmd, shell=shell, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, universal_newlines=True) + stderr=subprocess.PIPE, text=True) nm_output, nm_err = p.communicate() if p.returncode != 0: raise RuntimeError('failed to run "%s": "%s"' % ( diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index b3916a2c8..79ba08515 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -416,7 +416,7 @@ def cyg2win32(path: str) -> str: if sys.platform != "cygwin": return path return subprocess.check_output( - ["/usr/bin/cygpath", "--windows", path], universal_newlines=True + ["/usr/bin/cygpath", "--windows", path], text=True ) |
