summaryrefslogtreecommitdiff
path: root/numpy/distutils/cpuinfo.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-01-05 17:27:25 -0700
committerGitHub <noreply@github.com>2020-01-05 17:27:25 -0700
commitba81c4200f289b393755d954f7450804ec8f897a (patch)
tree9c5105f9d1974b355fd55a3adab09d83e2846490 /numpy/distutils/cpuinfo.py
parentb5739e8a81c71174b75cf4c8f9de4eccaa7eca2c (diff)
parentda0497fdf35a7bf851f3625b0df07cde950f5f49 (diff)
downloadnumpy-ba81c4200f289b393755d954f7450804ec8f897a.tar.gz
Merge pull request #15248 from eric-wieser/avoid-exc_info
MAINT: cleanup use of sys.exc_info
Diffstat (limited to 'numpy/distutils/cpuinfo.py')
-rw-r--r--numpy/distutils/cpuinfo.py12
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