Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#34272 closed Bug (fixed)

floatformat() crashes on "0.00".

Reported by: Andrii Lahuta Owned by: David Wobrock
Component: Template system Version: 4.2
Severity: Release blocker Keywords:
Cc: ziima, David Wobrock Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

from decimal import Decimal
from django.template.defaultfilters import floatformat

floatformat('0.00', 0)
floatformat(Decimal('0.00'), 0)

Both throw ValueError: valid range for prec is [1, MAX_PREC]

Change History (6)

comment:1 by Mariusz Felisiak, 22 months ago

Cc: ziima added
Severity: NormalRelease blocker
Summary: floatformat throws an error in some edge casesfloatformat() crashes on "0.00".
Triage Stage: UnreviewedAccepted

Thanks for the report and testing against the alpha release!

Regression in 08c5a787262c1ae57f6517d4574b54a5fcaad124.

#34098

Version 0, edited 22 months ago by Mariusz Felisiak (next)

comment:2 by David Wobrock, 22 months ago

Cc: David Wobrock added
Has patch: set
Owner: changed from nobody to David Wobrock
Status: newassigned

comment:3 by Mariusz Felisiak, 22 months ago

Patch needs improvement: set

comment:4 by Mariusz Felisiak, 22 months ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 22 months ago

Resolution: fixed
Status: assignedclosed

In 4b066bd:

Fixed #34272 -- Fixed floatformat crash on zero with trailing zeros to zero decimal places.

Regression in 08c5a787262c1ae57f6517d4574b54a5fcaad124.

Thanks Andrii Lahuta for the report.

comment:6 by Mariusz Felisiak <felisiak.mariusz@…>, 22 months ago

In 3b6f3073:

[4.2.x] Fixed #34272 -- Fixed floatformat crash on zero with trailing zeros to zero decimal places.

Regression in 08c5a787262c1ae57f6517d4574b54a5fcaad124.

Thanks Andrii Lahuta for the report.

Backport of 4b066bde692078b194709d517b27e55defae787c from main

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