Commit bcc288dc authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fixed using deprecated escaping in regular expression in _strptime.py (issue23622).

parent 80b8b3c4
...@@ -253,8 +253,8 @@ class TimeRE(dict): ...@@ -253,8 +253,8 @@ class TimeRE(dict):
# format directives (%m, etc.). # format directives (%m, etc.).
regex_chars = re_compile(r"([\\.^$*+?\(\){}\[\]|])") regex_chars = re_compile(r"([\\.^$*+?\(\){}\[\]|])")
format = regex_chars.sub(r"\\\1", format) format = regex_chars.sub(r"\\\1", format)
whitespace_replacement = re_compile('\s+') whitespace_replacement = re_compile(r'\s+')
format = whitespace_replacement.sub('\s+', format) format = whitespace_replacement.sub(r'\\s+', format)
while '%' in format: while '%' in format:
directive_index = format.index('%')+1 directive_index = format.index('%')+1
processed_format = "%s%s%s" % (processed_format, processed_format = "%s%s%s" % (processed_format,
......
...@@ -915,7 +915,7 @@ def parse_template(source, pattern): ...@@ -915,7 +915,7 @@ def parse_template(source, pattern):
if c in ASCIILETTERS: if c in ASCIILETTERS:
import warnings import warnings
warnings.warn('bad escape %s' % this, warnings.warn('bad escape %s' % this,
DeprecationWarning, stacklevel=5) DeprecationWarning, stacklevel=4)
lappend(this) lappend(this)
else: else:
lappend(this) lappend(this)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment