diff --git a/Lib/re.py b/Lib/re.py index a33e34e4e1e..90956f34e23 100644 --- a/Lib/re.py +++ b/Lib/re.py @@ -290,8 +290,8 @@ class Scanner: p.append(sre_parse.SubPattern(s, [ (SUBPATTERN, (len(p)+1, sre_parse.parse(phrase, flags))), ])) + s.groups = len(p)+1 p = sre_parse.SubPattern(s, [(BRANCH, (None, p))]) - s.groups = len(p) self.scanner = sre_compile.compile(p) def scan(self, string): result = []