mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Make sure parentheses are escaped when used in the format string.
Closes bug #796149 . Will be backported.
This commit is contained in:
parent
6676f6edc1
commit
953c6f508b
2 changed files with 10 additions and 1 deletions
|
@ -249,7 +249,7 @@ class TimeRE(dict):
|
|||
processed_format = ''
|
||||
# The sub() call escapes all characters that might be misconstrued
|
||||
# as regex syntax.
|
||||
regex_chars = re_compile(r"([\\.^$*+?{}\[\]|])")
|
||||
regex_chars = re_compile(r"([\\.^$*+?\(\){}\[\]|])")
|
||||
format = regex_chars.sub(r"\\\1", format)
|
||||
whitespace_replacement = re_compile('\s+')
|
||||
format = whitespace_replacement.sub('\s*', format)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue