File tree 2 files changed +2
-3
lines changed
2 files changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -1062,9 +1062,7 @@ def to_internal_value(self, data):
1062
1062
except decimal .DecimalException :
1063
1063
self .fail ('invalid' )
1064
1064
1065
- # Check for NaN. It is the only value that isn't equal to itself,
1066
- # so we can use this to identify NaN values.
1067
- if value != value :
1065
+ if value .is_nan ():
1068
1066
self .fail ('invalid' )
1069
1067
1070
1068
# Check for infinity and negative infinity.
Original file line number Diff line number Diff line change @@ -1080,6 +1080,7 @@ class TestDecimalField(FieldValues):
1080
1080
invalid_inputs = (
1081
1081
('abc' , ["A valid number is required." ]),
1082
1082
(Decimal ('Nan' ), ["A valid number is required." ]),
1083
+ (Decimal ('Snan' ), ["A valid number is required." ]),
1083
1084
(Decimal ('Inf' ), ["A valid number is required." ]),
1084
1085
('12.345' , ["Ensure that there are no more than 3 digits in total." ]),
1085
1086
(200000000000.0 , ["Ensure that there are no more than 3 digits in total." ]),
You can’t perform that action at this time.
0 commit comments