Opened 11 months ago

Closed 11 months ago

Last modified 11 months 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 Changed 11 months ago by Tim Graham

Has patch: set

comment:2 Changed 11 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In c886f3de:

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

comment:3 Changed 11 months ago by Tim Graham <timograham@…>

In 1dce629:

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

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