summaryrefslogtreecommitdiff
path: root/numpy/lib/ufunclike.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-04-25 15:22:58 -0600
committerGitHub <noreply@github.com>2020-04-25 15:22:58 -0600
commit651bb25d6b409b9031c40cf33f991d24f350edd3 (patch)
treec964055c79859d1cb901c42b42e1ae946af4699e /numpy/lib/ufunclike.py
parentf80584a48ca9bcb2ff451a017bee2479ad78aa28 (diff)
parentcadea53d822cf8e5c31ada659e49212bdceb3204 (diff)
downloadnumpy-651bb25d6b409b9031c40cf33f991d24f350edd3.tar.gz
Merge pull request #16064 from keremh/fix-exception-raise
ENH: Fix exception causes in four .py files
Diffstat (limited to 'numpy/lib/ufunclike.py')
-rw-r--r--numpy/lib/ufunclike.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py
index 8512669c2..1f26a1845 100644
--- a/numpy/lib/ufunclike.py
+++ b/numpy/lib/ufunclike.py
@@ -188,9 +188,9 @@ def isposinf(x, out=None):
is_inf = nx.isinf(x)
try:
signbit = ~nx.signbit(x)
- except TypeError:
+ except TypeError as e:
raise TypeError('This operation is not supported for complex values '
- 'because it would be ambiguous.')
+ 'because it would be ambiguous.') from e
else:
return nx.logical_and(is_inf, signbit, out)
@@ -259,8 +259,8 @@ def isneginf(x, out=None):
is_inf = nx.isinf(x)
try:
signbit = nx.signbit(x)
- except TypeError:
+ except TypeError as e:
raise TypeError('This operation is not supported for complex values '
- 'because it would be ambiguous.')
+ 'because it would be ambiguous.') from e
else:
return nx.logical_and(is_inf, signbit, out)