Skip to content

gh-153177: Deprecate re.LOCALE#153178

Open
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:re-deprecate-locale
Open

gh-153177: Deprecate re.LOCALE#153178
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:re-deprecate-locale

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 6, 2026

Copy link
Copy Markdown
Member

Emit a DeprecationWarning when a compiled pattern uses the re.LOCALE flag or the inline flag (?L) (also in the scoped form (?L:...)). The warning is emitted once per actual compilation, from a single place in the compiler, and points at the caller of the re function.

The flag only works with bytes patterns in 8-bit locales and makes matching much slower. Planned removal is no earlier than Python 3.18.

The flag only works with bytes patterns in 8-bit locales and makes
matching much slower.  Emit a DeprecationWarning when a pattern uses
the flag or the inline flag (?L).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread Doc/library/re.rst Outdated
@read-the-docs-community

read-the-docs-community Bot commented Jul 6, 2026

Copy link
Copy Markdown

Co-authored-by: Stan Ulbrych <stan@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants