Skip to content

Locale.parse() no longer accepts None as the locale identifier #977

@neuroid

Description

@neuroid

Overview Description

Locale.parse() no longer accepts None as the locale identifier, contrary to the type annotation.

Steps to Reproduce

>>> from babel import Locale
>>> Locale.parse(None) is None

Actual Results

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/env/lib/python3.8/site-packages/babel/core.py", line 317, in parse
    raise TypeError(f"Unexpected value for identifier: {identifier!r}")
TypeError: Unexpected value for identifier: None

Expected Results

True

Reproducibility

👍

Additional Information

Arguably, the previous behaviour was useful. However, if this breaking change is intentional, the type annotation should be adjusted accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions