From 15fa1c4ade79060e340a656e1f69c70ebe355171 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 25 Mar 2015 01:21:50 +0200 Subject: Fixed using deprecated escaping in regular expression in _strptime.py (issue23622). --- Lib/_strptime.py | 4 ++-- Lib/sre_parse.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/_strptime.py b/Lib/_strptime.py index f4a98ec..374923d 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -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, diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index af729c3..e6f1f1d 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -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) -- cgit v0.12