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.

Author serhiy.storchaka
Recipients ezio.melotti, mrabarnett, pitrou, serhiy.storchaka
Date 2014-09-18.13:52:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Here is a patch which implements Matthew's suggestion. It significant slow down the use of locale-sensitive regular expressions, there is a possibility for race condition between compiling and matching, and it doesn't solve the issue for explicitly cached expressions. Also I prefer that matching depends on locale at the time of matching, not at the time of compiling.

This patch can be considered as nonperfect solution for 3.4 and 2.7. But for 3.5 I'll try to implement better solution.

$ ./python -m timeit -s 'import re' -- 're.match(br"\w+", b"abc", re.L)'

Before patch: 100000 loops, best of 3: 10.4 usec per loop

After patch: 10000 loops, best of 3: 37.5 usec per loop
Date User Action Args
2014-09-18 13:52:49serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, ezio.melotti, mrabarnett
2014-09-18 13:52:49serhiy.storchakasetmessageid: <>
2014-09-18 13:52:49serhiy.storchakalinkissue22410 messages
2014-09-18 13:52:49serhiy.storchakacreate