Fixed NaN checking which throws exception with sNaN value

This commit is contained in:
Sergei Lavrov 2019-10-17 22:03:15 +03:00
parent 896b872375
commit 208e7ac125

View File

@ -1062,9 +1062,7 @@ class DecimalField(Field):
except decimal.DecimalException: except decimal.DecimalException:
self.fail('invalid') self.fail('invalid')
# Check for NaN. It is the only value that isn't equal to itself, if value.is_nan():
# so we can use this to identify NaN values.
if value != value:
self.fail('invalid') self.fail('invalid')
# Check for infinity and negative infinity. # Check for infinity and negative infinity.