Skip to content

New MaxValueValidator on NumberFilter triggers Decimal FloatOperation trap #1275

@wearebasti

Description

@wearebasti

The in 2.4.0 introduced MaxValueValidator sets as default 1e50 leading to have a float as max value, but the NumberFilter uses a DecimalField as base leading to FloatOperation exceptions if the corresponding trap is activated on the Decimal context. (https://docs.python.org/3/library/decimal.html#decimal.FloatOperation)

This is not visible for most people, I guess - we've it on in our test/dev-setup to not mix Floats and Decimals. I assume the max-value should either be a Decimal itself? (or a int(1e50) would probably suffice already.

In [2]: type(1e50)
Out[2]: float

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions