8000 MAINT: Fix the dtype mentioned in 2 `np.lib.ufunclike` exceptions · numpy/numpy@692f00b · GitHub
[go: up one dir, main page]

Skip to content

Commit 692f00b

Browse files
author
Bas van Beek
committed
MAINT: Fix the dtype mentioned in 2 np.lib.ufunclike exceptions
1 parent 58e3b94 commit 692f00b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

numpy/lib/ufunclike.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ def isposinf(x, out=None):
189189
try:
190190
signbit = ~nx.signbit(x)
191191
except TypeError as e:
192-
raise TypeError('This operation is not supported for complex values '
192+
dtype = nx.asanyarray(x).dtype
193+
raise TypeError(f'This operation is not supported for {dtype} values '
193194
'because it would be ambiguous.') from e
194195
else:
195196
return nx.logical_and(is_inf, signbit, out)
@@ -260,7 +261,8 @@ def isneginf(x, out=None):
260261
try:
261262
signbit = nx.signbit(x)
262263
except TypeError as e:
263-
raise TypeError('This operation is not supported for complex values '
264+
dtype = nx.asanyarray(x).dtype
265+
raise TypeError(f'This operation is not supported for {dtype} values '
264266
'because it would be ambiguous.') from e
265267
else:
266268
return nx.logical_and(is_inf, signbit, out)

0 commit comments

Comments
 (0)
0