Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#29006 closed Bug (fixed)

DecimalField.clean() crashes on sNaN values

Reported by: Tim Graham Owned by: Tim Graham
Component: Forms Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

>>> from django.forms import DecimalField
>>> DecimalField(max_digits=4, decimal_places=2)
>>> f.clean('sNan')
....
  File "django/django/forms/fields.py", line 148, in clean
    self.validate(value)
  File "django/django/forms/fields.py", line 354, in validate
    if not math.isfinite(value):
ValueError: cannot convert signaling NaN to float

Change History (3)

comment:1 by Tim Graham, 7 years ago

Has patch: set

comment:2 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In c886f3de:

Fixed #29006 -- Fixed DecimalField.clean() crash on sNaN values.

comment:3 by Tim Graham <timograham@…>, 7 years ago

In 1dce629:

Refs #29006 -- Simplified handling of SNaN values in DecimalField.validate().

Note: See TracTickets for help on using tickets.
Back to Top