Make sure parentheses are escaped when used in the format string.

Closes bug #796149 .  Will be backported.
This commit is contained in:
Brett Cannon 2003-08-29 02:28:54 +00:00
parent 6676f6edc1
commit 953c6f508b
2 changed files with 10 additions and 1 deletions

View file

@ -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)