summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-04-12 11:38:42 -0600
committerGitHub <noreply@github.com>2021-04-12 11:38:42 -0600
commitd0d80b9d35bfe2be5cf1911ad9272551a25f1eaf (patch)
tree17fdcc1218c51c7ee7020678e623ae8df0bc3c78 /benchmarks
parent912cf8d8166d6863f10b151cb6267603d8b681e0 (diff)
parentfdeb9794d94a44fedb32c5b0cba5713c1b5f78e6 (diff)
downloadnumpy-d0d80b9d35bfe2be5cf1911ad9272551a25f1eaf.tar.gz
Merge pull request #18728 from anthonyhvo12/avo-exceptions-chaining
MAINT: Add exception chaining where appropriate
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/benchmarks/bench_linalg.py4
-rw-r--r--benchmarks/benchmarks/bench_ufunc_strides.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/benchmarks/benchmarks/bench_linalg.py b/benchmarks/benchmarks/bench_linalg.py
index a72cccb5f..5ed5b6eec 100644
--- a/benchmarks/benchmarks/bench_linalg.py
+++ b/benchmarks/benchmarks/bench_linalg.py
@@ -91,8 +91,8 @@ class Linalg(Benchmark):
# check that dtype is supported at all
try:
self.func(self.a[:2, :2])
- except TypeError:
- raise NotImplementedError()
+ except TypeError as e:
+ raise NotImplementedError() from e
def time_op(self, op, typename):
self.func(self.a)
diff --git a/benchmarks/benchmarks/bench_ufunc_strides.py b/benchmarks/benchmarks/bench_ufunc_strides.py
index 58f325e76..213ff0020 100644
--- a/benchmarks/benchmarks/bench_ufunc_strides.py
+++ b/benchmarks/benchmarks/bench_ufunc_strides.py
@@ -33,7 +33,7 @@ class Unary(Benchmark):
try:
self.f = getattr(np, ufuncname)
except AttributeError:
- raise NotImplementedError()
+ raise NotImplementedError(f"No ufunc {ufuncname} found") from None
N = 10000
self.arr = np.ones(stride*N, dtype)
self.arr_out = np.empty(stride_out*N, dtype)
@@ -68,7 +68,7 @@ class AVX_BFunc(Benchmark):
try:
self.f = getattr(np, ufuncname)
except AttributeError:
- raise NotImplementedError()
+ raise NotImplementedError(f"No ufunc {ufuncname} found") from None
N = 10000
self.arr1 = np.array(np.random.rand(stride*N), dtype=dtype)
self.arr2 = np.array(np.random.rand(stride*N), dtype=dtype)
@@ -109,7 +109,7 @@ class AVX_cmplx_arithmetic(Benchmark):
try:
self.f = getattr(np, bfuncname)
except AttributeError:
- raise NotImplementedError()
+ raise NotImplementedError(f"No bfunc {bfuncname} found") from None
N = 10000
self.arr1 = np.ones(stride*N, dtype)
self.arr2 = np.ones(stride*N, dtype)
@@ -132,7 +132,7 @@ class AVX_cmplx_funcs(Benchmark):
try:
self.f = getattr(np, bfuncname)
except AttributeError:
- raise NotImplementedError()
+ raise NotImplementedError(f"No bfunc {bfuncname} found") from None
N = 10000
self.arr1 = np.ones(stride*N, dtype)