mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Make _strptime.TimeRE().pattern() use `\s+
` for matching whitespace instead
of ``\s*``. This prevents patterns from "stealing" bits from other patterns in order to make a match work. Closes bug #1730389. Will be backported.
This commit is contained in:
parent
994ebed50c
commit
f7188cefb3
3 changed files with 13 additions and 1 deletions
|
@ -250,7 +250,7 @@ class TimeRE(dict):
|
|||
regex_chars = re_compile(r"([\\.^$*+?\(\){}\[\]|])")
|
||||
format = regex_chars.sub(r"\\\1", format)
|
||||
whitespace_replacement = re_compile('\s+')
|
||||
format = whitespace_replacement.sub('\s*', format)
|
||||
format = whitespace_replacement.sub('\s+', format)
|
||||
while '%' in format:
|
||||
directive_index = format.index('%')+1
|
||||
processed_format = "%s%s%s" % (processed_format,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue