One function

Number in alecthomas/voluptuous

The author described this change as Raise Invalid for non-numeric input to Number validator (#539). It counts as a record because the check below fails on the code as it stood at d20c6c8bc and passes on 9dd222db1, with nothing else changed between the two runs.

Fix saved2026-07-04
Sharing licenceBSD-3-Clause · COPYING
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

Verify the number of digits that are present in the number(Precision), and the decimal places(Scale). :raises Invalid: If the value does not match the provided Precision and Scale.

The change

7171 """
7272 try:
7373 decimal_num = Decimal(number)
74- except InvalidOperation:
74+ except (InvalidOperation, TypeError, ValueError):
7575 raise Invalid(self.msg or 'Value must be a number enclosed with string')
7676
7777 exp = decimal_num.as_tuple().exponent

The check that tells the two apart

failpass·voluptuous/tests/tests.py::test_number_validation_with_non_numeric

Check file voluptuous/tests/tests.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itd20c6c8bc7f49f94668e38289655cabb33ff2602
Broken version dated2026-07-04
Modulevoluptuous.validators
Units changedNumber
Fingerprint7df551b2eb368cbd
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in alecthomas/voluptuous