summaryrefslogtreecommitdiff
path: root/numpy/linalg/linalg.py
diff options
context:
space:
mode:
authorChris Holland <chrisholland3553@gmail.com>2020-04-23 20:19:39 -0700
committerChris Holland <chrisholland3553@gmail.com>2020-04-23 20:19:39 -0700
commit45126aa4caa9ae9f83ec7d5235ca07c59a4d0747 (patch)
tree179b82735a71d87d9ce30b2915f2d2bbd33bac62 /numpy/linalg/linalg.py
parentbcb036a58aac566d4050b163a0f6b77e09c40123 (diff)
downloadnumpy-45126aa4caa9ae9f83ec7d5235ca07c59a4d0747.tar.gz
Added some chained exceptions
Diffstat (limited to 'numpy/linalg/linalg.py')
-rw-r--r--numpy/linalg/linalg.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index eac6267c6..6d3afdd49 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -622,8 +622,8 @@ def matrix_power(a, n):
try:
n = operator.index(n)
- except TypeError:
- raise TypeError("exponent must be an integer")
+ except TypeError as e:
+ raise TypeError("exponent must be an integer") from e
# Fall back on dot for object arrays. Object arrays are not supported by
# the current implementation of matmul using einsum
@@ -2540,8 +2540,8 @@ def norm(x, ord=None, axis=None, keepdims=False):
elif not isinstance(axis, tuple):
try:
axis = int(axis)
- except Exception:
- raise TypeError("'axis' must be None, an integer or a tuple of integers")
+ except Exception as e:
+ raise TypeError("'axis' must be None, an integer or a tuple of integers") from e
axis = (axis,)
if len(axis) == 1: