Issue #28070: Fixed parsing inline verbose flag in regular expressions.
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index 09f3be2..d74e93f 100644
--- 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
index 2322ca9..afe8738 100644
--- 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('$')