Skip to content

Commit 18b4a54

Browse files
committed
use math.isfinite
1 parent 2e4bd65 commit 18b4a54

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/cbook.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,8 +1634,10 @@ def _safe_first_finite(obj, *, skip_nonfinite=True):
16341634
def safe_isfinite(val):
16351635
if val is None:
16361636
return False
1637-
if isinstance(val, int):
1638-
return True
1637+
try:
1638+
return math.isfinite(val)
1639+
except TypeError:
1640+
pass
16391641
try:
16401642
return np.isfinite(val) if np.isscalar(val) else True
16411643
except TypeError:

0 commit comments

Comments
 (0)