diff options
Diffstat (limited to 'numpy/distutils/cpuinfo.py')
-rw-r--r-- | numpy/distutils/cpuinfo.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/numpy/distutils/cpuinfo.py b/numpy/distutils/cpuinfo.py index ebd257eea..efea90113 100644 --- a/numpy/distutils/cpuinfo.py +++ b/numpy/distutils/cpuinfo.py @@ -25,13 +25,10 @@ else: import warnings import platform -from numpy.distutils.compat import get_exception - def getoutput(cmd, successful_status=(0,), stacklevel=1): try: status, output = getstatusoutput(cmd) - except EnvironmentError: - e = get_exception() + except EnvironmentError as e: warnings.warn(str(e), UserWarning, stacklevel=stacklevel) return False, "" if os.WIFEXITED(status) and os.WEXITSTATUS(status) in successful_status: @@ -113,8 +110,7 @@ class LinuxCPUInfo(CPUInfoBase): info[0]['uname_m'] = output.strip() try: fo = open('/proc/cpuinfo') - except EnvironmentError: - e = get_exception() + except EnvironmentError as e: warnings.warn(str(e), UserWarning, stacklevel=2) else: for line in fo: @@ -521,8 +517,8 @@ class Win32CPUInfo(CPUInfoBase): info[-1]["Family"]=int(srch.group("FML")) info[-1]["Model"]=int(srch.group("MDL")) info[-1]["Stepping"]=int(srch.group("STP")) - except Exception: - print(sys.exc_info()[1], '(ignoring)') + except Exception as e: + print(e, '(ignoring)') self.__class__.info = info def _not_impl(self): pass |