[Python-checkins] cpython: Issue #28070: Fixed parsing inline verbose flag in regular expressions.
serhiy.storchaka
python-checkins at python.org
Sat Sep 10 18:43:33 EDT 2016
https://hg.python.org/cpython/rev/bee52e5f8fb1
changeset: 103591:bee52e5f8fb1
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun Sep 11 01:39:01 2016 +0300
summary:
Issue #28070: Fixed parsing inline verbose flag in regular expressions.
files:
Lib/sre_parse.py | 1 +
Lib/test/test_re.py | 3 +++
Misc/NEWS | 2 ++
3 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -847,6 +847,7 @@
pattern = Pattern()
pattern.flags = flags | SRE_FLAG_VERBOSE
pattern.str = str
+ source.seek(0)
p = _parse_sub(source, pattern, True, False)
p.pattern.flags = fix_flags(str, p.pattern.flags)
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -1276,6 +1276,9 @@
q = p.match(upper_char)
self.assertTrue(q)
+ self.assertTrue(re.match('(?ixu) ' + upper_char, lower_char))
+ self.assertTrue(re.match('(?ixu) ' + lower_char, upper_char))
+
def test_dollar_matches_twice(self):
"$ matches the end of string, and just before the terminating \n"
pattern = re.compile('$')
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -138,6 +138,8 @@
Library
-------
+- Issue #28070: Fixed parsing inline verbose flag in regular expressions.
+
- Issue #19500: Add client-side SSL session resumption to the ssl module.
- Issue #28022: Deprecate ssl-related arguments in favor of SSLContext. The
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list