Opened 6 years ago

Closed 6 years ago

#29007 closed Bug (fixed)

DecimalValidator crashes on NaN, SNan, Inf, and Infinity values

Reported by: Fabio Bonelli Owned by: nobody
Component: Core (Other) 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

DecimalValidator crashes if it receives a value like NaN, SNan, Inf, and Infinity.

>>> DecimalValidator(decimal_places=2, max_digits=10)(Decimal('NaN'))
...
  File "django/tests/validators/tests.py", line 322, in test_func
    validator(value)
  File "django/django/core/validators.py", line 417, in __call__
    if exponent >= 0:
TypeError: unorderable types: str() >= int()

PR

Change History (1)

comment:1 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: newclosed

In f636f0bb:

Fixed #29007 -- Fixed DecimalValidator crash on NaN, SNan, Inf, and Infinity values.

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