mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 17:09:59 +03:00
Fixed NaN checking which throws exception with sNaN value
This commit is contained in:
parent
896b872375
commit
208e7ac125
|
@ -1062,9 +1062,7 @@ class DecimalField(Field):
|
|||
except decimal.DecimalException:
|
||||
self.fail('invalid')
|
||||
|
||||
# Check for NaN. It is the only value that isn't equal to itself,
|
||||
# so we can use this to identify NaN values.
|
||||
if value != value:
|
||||
if value.is_nan():
|
||||
self.fail('invalid')
|
||||
|
||||
# Check for infinity and negative infinity.
|
||||
|
|
Loading…
Reference in New Issue
Block a user