Skip to content

Fix Locale subclass __str__ issue#1271

Open
Chiifouu wants to merge 1 commit intopython-babel:masterfrom
Chiifouu:master
Open

Fix Locale subclass __str__ issue#1271
Chiifouu wants to merge 1 commit intopython-babel:masterfrom
Chiifouu:master

Conversation

@Chiifouu
Copy link
Copy Markdown

@Chiifouu Chiifouu commented May 9, 2026

Fixes #1252

I noticed that Locale.init was using str(self) to build the identifier. This breaks when a subclass overrides str with a custom format.

This PR replaces it with get_locale_identifier() and adds a small test to make sure subclassed Locale objects work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Locale class uses str(...) in __init__

1 participant