This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Make re.compile() locale agnostic
Type: behavior Stage: resolved
Components: Extension Modules, Library (Lib), Regular Expressions Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: ezio.melotti, mrabarnett, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-04-30 05:21 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1361 merged serhiy.storchaka, 2017-04-30 05:37
Messages (3)
msg292618 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-30 05:21
Currently the result of re.compile() with the re.LOCALE flag depends on the locale at compile time.  The locale at matching time should be the same as the locale at compile time, otherwise the matching can work incorrectly. This complicates caching in module global functions and increase the chance of race condition.

Proposed patch makes re.compile() not depending on locale. Only the locale at matching time affects the result of matching.

This is more comprehensive solution of issue22410.
msg292970 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-04 09:23
This change can be considered as a bug fix, but I hesitate to apply it to maintained releases because the effect on the performance of case-sensitive locale-depending bytes matching is hardly predicable. Some matches become 5 times faster, others become 1.5 times slower, depending on the cases of the pattern and the matched bytestring.
msg293044 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-05 05:53
New changeset 898ff03e1e7925ecde3da66327d3cdc7e07625ba by Serhiy Storchaka in branch 'master':
bpo-30215: Make re.compile() locale agnostic. (#1361)
Date User Action Args
2022-04-11 14:58:45adminsetgithub: 74401
2017-05-05 06:42:44serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-05-05 05:53:42serhiy.storchakasetmessages: + msg293044
2017-05-04 09:23:25serhiy.storchakasetmessages: + msg292970
2017-05-04 05:51:55serhiy.storchakasetassignee: serhiy.storchaka
2017-04-30 05:37:20serhiy.storchakasetpull_requests: + pull_request1471
2017-04-30 05:21:39serhiy.storchakacreate