From d65cd091e9c10cd55c3e19c45930c539d896c61a Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 11 Sep 2016 01:39:01 +0300 Subject: [PATCH] Issue #28070: Fixed parsing inline verbose flag in regular expressions. --- Lib/sre_parse.py | 1 + Lib/test/test_re.py | 3 +++ Misc/NEWS | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 09f3be25ab9..d74e93ff5c8 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -847,6 +847,7 @@ def parse(str, flags=0, pattern=None): 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 index 2322ca9bb45..afe8738e837 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -1276,6 +1276,9 @@ class ReTests(unittest.TestCase): 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 index 8c4fbc92cd6..7ce539150ec 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -138,6 +138,8 @@ Core and Builtins 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