mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
#2834: Change re module semantics, so that str and bytes mixing is forbidden,
and str (unicode) patterns get full unicode matching by default. The re.ASCII flag is also introduced to ask for ASCII matching instead.
This commit is contained in:
parent
3ad7ba10a2
commit
fd036451bf
37 changed files with 280 additions and 163 deletions
|
@ -14,7 +14,7 @@ import time
|
|||
import locale
|
||||
import calendar
|
||||
from re import compile as re_compile
|
||||
from re import IGNORECASE
|
||||
from re import IGNORECASE, ASCII
|
||||
from re import escape as re_escape
|
||||
from datetime import date as datetime_date
|
||||
try:
|
||||
|
@ -262,7 +262,7 @@ class TimeRE(dict):
|
|||
|
||||
def compile(self, format):
|
||||
"""Return a compiled re object for the format string."""
|
||||
return re_compile(self.pattern(format), IGNORECASE)
|
||||
return re_compile(self.pattern(format), IGNORECASE | ASCII)
|
||||
|
||||
_cache_lock = _thread_allocate_lock()
|
||||
# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue