Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
neuroid opened this issue Feb 28, 2023 · 1 comment
Closed

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

neuroid opened this issue Feb 28, 2023 · 1 comment
Labels

Comments

@neuroid
Copy link

neuroid commented Feb 28, 2023

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.

@akx
Copy link
Member

akx commented Mar 1, 2023

This change was intentional (happened in #966) (but I forgot to distil it into the changelog).

Why would the behaviour be useful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants