The type annotations for the locale parameter (e.g. in babel.numbers.format_currency() suggest that the value can be None, but this causes a TypeError in Locale.parse().
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
babel.numbers.format_currency(0, "USD", locale=None)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.13/site-packages/babel/numbers.py", line 777, in format_currency
locale = Locale.parse(locale)
File ".venv/lib/python3.13/site-packages/babel/core.py", line 332, in parse
raise TypeError(f"Unexpected value for identifier: {identifier!r}")
TypeError: Unexpected value for identifier: None
Expected Results
I would expect a value of None to use the default value, or None should be removed from the type annotations entirely.
Overview Description
The type annotations for the
locale
parameter (e.g. inbabel.numbers.format_currency()
suggest that the value can beNone
, but this causes aTypeError
inLocale.parse()
.Steps to Reproduce
Actual Results
Expected Results
I would expect a value of
None
to use the default value, orNone
should be removed from the type annotations entirely.Reproducibility
Additional Information