mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Fixed using deprecated escaping in regular expression in _strptime.py (issue23622).
This commit is contained in:
parent
8be6be427d
commit
15fa1c4ade
2 changed files with 3 additions and 3 deletions
|
@ -253,8 +253,8 @@ class TimeRE(dict):
|
|||
# format directives (%m, etc.).
|
||||
regex_chars = re_compile(r"([\\.^$*+?\(\){}\[\]|])")
|
||||
format = regex_chars.sub(r"\\\1", format)
|
||||
whitespace_replacement = re_compile('\s+')
|
||||
format = whitespace_replacement.sub('\s+', format)
|
||||
whitespace_replacement = re_compile(r'\s+')
|
||||
format = whitespace_replacement.sub(r'\\s+', format)
|
||||
while '%' in format:
|
||||
directive_index = format.index('%')+1
|
||||
processed_format = "%s%s%s" % (processed_format,
|
||||
|
|
|
@ -915,7 +915,7 @@ def parse_template(source, pattern):
|
|||
if c in ASCIILETTERS:
|
||||
import warnings
|
||||
warnings.warn('bad escape %s' % this,
|
||||
DeprecationWarning, stacklevel=5)
|
||||
DeprecationWarning, stacklevel=4)
|
||||
lappend(this)
|
||||
else:
|
||||
lappend(this)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue