Commit d65cd091 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #28070: Fixed parsing inline verbose flag in regular expressions.

parent 99a65702
...@@ -847,6 +847,7 @@ def parse(str, flags=0, pattern=None): ...@@ -847,6 +847,7 @@ def parse(str, flags=0, pattern=None):
pattern = Pattern() pattern = Pattern()
pattern.flags = flags | SRE_FLAG_VERBOSE pattern.flags = flags | SRE_FLAG_VERBOSE
pattern.str = str pattern.str = str
source.seek(0)
p = _parse_sub(source, pattern, True, False) p = _parse_sub(source, pattern, True, False)
p.pattern.flags = fix_flags(str, p.pattern.flags) p.pattern.flags = fix_flags(str, p.pattern.flags)
......
...@@ -1276,6 +1276,9 @@ class ReTests(unittest.TestCase): ...@@ -1276,6 +1276,9 @@ class ReTests(unittest.TestCase):
q = p.match(upper_char) q = p.match(upper_char)
self.assertTrue(q) 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): def test_dollar_matches_twice(self):
"$ matches the end of string, and just before the terminating \n" "$ matches the end of string, and just before the terminating \n"
pattern = re.compile('$') pattern = re.compile('$')
......
...@@ -138,6 +138,8 @@ Core and Builtins ...@@ -138,6 +138,8 @@ Core and Builtins
Library Library
------- -------
- Issue #28070: Fixed parsing inline verbose flag in regular expressions.
- Issue #19500: Add client-side SSL session resumption to the ssl module. - Issue #19500: Add client-side SSL session resumption to the ssl module.
- Issue #28022: Deprecate ssl-related arguments in favor of SSLContext. The - Issue #28022: Deprecate ssl-related arguments in favor of SSLContext. The
......
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