Skip to content

Accept C and POSIX in Locale.parse - #1340

Open
gyanu2507 wants to merge 1 commit into
python-babel:masterfrom
gyanu2507:fix/parse-c-posix-locale
Open

Accept C and POSIX in Locale.parse#1340
gyanu2507 wants to merge 1 commit into
python-babel:masterfrom
gyanu2507:fix/parse-c-posix-locale

Conversation

@gyanu2507

@gyanu2507 gyanu2507 commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #1236.

default_locale() maps C, POSIX, and C.UTF-8 to en_US_POSIX. Locale.parse() did not, so Locale.parse("C") raised UnknownLocaleError: unknown locale 'c'. That is the frame in the report.

parse() now applies the same mapping (case-insensitive, optional encoding suffix) before parse_locale. en_US_POSIX with a POSIX variant is unchanged.

default_locale already maps those to en_US_POSIX. parse() did not, so a
C locale from the environment raised UnknownLocaleError.
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.

Babel fails to handle C locale properly

1 participant