diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2021-09-02 10:28:28 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-02 10:28:28 -0600 |
| commit | 95d254027f2fb526fe4c745f330e6fa448a7e4db (patch) | |
| tree | dceb9f90936601187aa6450139cdf26912b4db3b /numpy/distutils | |
| parent | 47368730049ac394c50d2b73fa51e671c1320984 (diff) | |
| parent | 7ad8ea7b11e3544b133d8b397dd3bbe4833d3308 (diff) | |
| download | numpy-95d254027f2fb526fe4c745f330e6fa448a7e4db.tar.gz | |
Merge pull request #19815 from mwtoews/maint-ioerror
MAINT: revise OSError aliases (IOError, EnvironmentError)
Diffstat (limited to 'numpy/distutils')
| -rw-r--r-- | numpy/distutils/ccompiler_opt.py | 4 | ||||
| -rw-r--r-- | numpy/distutils/cpuinfo.py | 4 | ||||
| -rw-r--r-- | numpy/distutils/exec_command.py | 2 | ||||
| -rw-r--r-- | numpy/distutils/fcompiler/compaq.py | 4 | ||||
| -rw-r--r-- | numpy/distutils/npy_pkg_config.py | 4 | ||||
| -rw-r--r-- | numpy/distutils/unixccompiler.py | 2 |
6 files changed, 10 insertions, 10 deletions
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py index 1942aa06e..e7fd494d3 100644 --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -521,7 +521,7 @@ class _Config: def rm_temp(): try: shutil.rmtree(tmp) - except IOError: + except OSError: pass atexit.register(rm_temp) self.conf_tmp_path = tmp @@ -2500,7 +2500,7 @@ class CCompilerOpt(_Config, _Distutils, _Cache, _CCompiler, _Feature, _Parse): last_hash = f.readline().split("cache_hash:") if len(last_hash) == 2 and int(last_hash[1]) == cache_hash: return True - except IOError: + except OSError: pass self.dist_log("generate dispatched config -> ", config_path) diff --git a/numpy/distutils/cpuinfo.py b/numpy/distutils/cpuinfo.py index 51ce3c129..776202109 100644 --- a/numpy/distutils/cpuinfo.py +++ b/numpy/distutils/cpuinfo.py @@ -27,7 +27,7 @@ from subprocess import getstatusoutput def getoutput(cmd, successful_status=(0,), stacklevel=1): try: status, output = getstatusoutput(cmd) - except EnvironmentError as e: + except OSError as e: warnings.warn(str(e), UserWarning, stacklevel=stacklevel) return False, "" if os.WIFEXITED(status) and os.WEXITSTATUS(status) in successful_status: @@ -109,7 +109,7 @@ class LinuxCPUInfo(CPUInfoBase): info[0]['uname_m'] = output.strip() try: fo = open('/proc/cpuinfo') - except EnvironmentError as e: + except OSError as e: warnings.warn(str(e), UserWarning, stacklevel=2) else: for line in fo: diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py index fb10d2470..79998cf5d 100644 --- a/numpy/distutils/exec_command.py +++ b/numpy/distutils/exec_command.py @@ -284,7 +284,7 @@ def _exec_command(command, use_shell=None, use_tee = None, **env): stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=False) - except EnvironmentError: + except OSError: # Return 127, as os.spawn*() and /bin/sh do return 127, '' diff --git a/numpy/distutils/fcompiler/compaq.py b/numpy/distutils/fcompiler/compaq.py index 351a43dd7..01314c136 100644 --- a/numpy/distutils/fcompiler/compaq.py +++ b/numpy/distutils/fcompiler/compaq.py @@ -84,9 +84,9 @@ class CompaqVisualFCompiler(FCompiler): print('Ignoring "%s" (I think it is msvccompiler.py bug)' % (e)) else: raise - except IOError as e: + except OSError as e: if not "vcvarsall.bat" in str(e): - print("Unexpected IOError in", __file__) + print("Unexpected OSError in", __file__) raise except ValueError as e: if not "'path'" in str(e): diff --git a/numpy/distutils/npy_pkg_config.py b/numpy/distutils/npy_pkg_config.py index 951ce5fb8..f6e3ad397 100644 --- a/numpy/distutils/npy_pkg_config.py +++ b/numpy/distutils/npy_pkg_config.py @@ -9,7 +9,7 @@ __all__ = ['FormatError', 'PkgNotFound', 'LibraryInfo', 'VariableSet', _VAR = re.compile(r'\$\{([a-zA-Z0-9_-]+)\}') -class FormatError(IOError): +class FormatError(OSError): """ Exception thrown when there is a problem parsing a configuration file. @@ -20,7 +20,7 @@ class FormatError(IOError): def __str__(self): return self.msg -class PkgNotFound(IOError): +class PkgNotFound(OSError): """Exception raised when a package can not be located.""" def __init__(self, msg): self.msg = msg diff --git a/numpy/distutils/unixccompiler.py b/numpy/distutils/unixccompiler.py index fb91f1789..733a9fc50 100644 --- a/numpy/distutils/unixccompiler.py +++ b/numpy/distutils/unixccompiler.py @@ -105,7 +105,7 @@ def UnixCCompiler_create_static_lib(self, objects, output_libname, # and recreate. # Also, ar on OS X doesn't handle updating universal archives os.unlink(output_filename) - except (IOError, OSError): + except OSError: pass self.mkpath(os.path.dirname(output_filename)) tmp_objects = objects + self.objects |
