summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnumpy/linalg/lapack_lite/make_lite.py4
-rw-r--r--numpy/linalg/tests/test_build.py4
-rw-r--r--numpy/linalg/tests/test_linalg.py4
3 files changed, 6 insertions, 6 deletions
diff --git a/numpy/linalg/lapack_lite/make_lite.py b/numpy/linalg/lapack_lite/make_lite.py
index cf15b2541..b145f6c4f 100755
--- a/numpy/linalg/lapack_lite/make_lite.py
+++ b/numpy/linalg/lapack_lite/make_lite.py
@@ -261,8 +261,8 @@ def runF2C(fortran_filename, output_dir):
subprocess.check_call(
["f2c"] + F2C_ARGS + ['-d', output_dir, fortran_filename]
)
- except subprocess.CalledProcessError:
- raise F2CError
+ except subprocess.CalledProcessError as e:
+ raise F2CError from e
def scrubF2CSource(c_file):
with open(c_file) as fo:
diff --git a/numpy/linalg/tests/test_build.py b/numpy/linalg/tests/test_build.py
index 4859226d9..868341ff2 100644
--- a/numpy/linalg/tests/test_build.py
+++ b/numpy/linalg/tests/test_build.py
@@ -15,8 +15,8 @@ class FindDependenciesLdd:
try:
p = Popen(self.cmd, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
- except OSError:
- raise RuntimeError(f'command {self.cmd} cannot be run')
+ except OSError as e:
+ raise RuntimeError(f'command {self.cmd} cannot be run') from e
def get_dependencies(self, lfile):
p = Popen(self.cmd + [lfile], stdout=PIPE, stderr=PIPE)
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py
index 21fab58e1..8a270f194 100644
--- a/numpy/linalg/tests/test_linalg.py
+++ b/numpy/linalg/tests/test_linalg.py
@@ -348,10 +348,10 @@ class LinalgTestCase:
try:
case.check(self.do)
- except Exception:
+ except Exception as e:
msg = f'In test case: {case!r}\n\n'
msg += traceback.format_exc()
- raise AssertionError(msg)
+ raise AssertionError(msg) from e
class LinalgSquareTestCase(LinalgTestCase):