Use math.isfinite instead of explicitly checking for both nan and inf (#98103)

This commit is contained in:
Erik Montnemery
2023-08-09 14:13:57 +02:00
committed by GitHub
parent 7e9d0cca44
commit e1f0b44ba4
3 changed files with 3 additions and 3 deletions

View File

@@ -1934,7 +1934,7 @@ def is_number(value):
fvalue = float(value)
except (ValueError, TypeError):
return False
if math.isnan(fvalue) or math.isinf(fvalue):
if not math.isfinite(fvalue):
return False
return True