]> granicus.if.org Git - python/commitdiff
In the experimental 'Scanner' feature, the group count was set wrong.
authorGuido van Rossum <guido@python.org>
Tue, 5 Feb 2008 17:32:15 +0000 (17:32 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 5 Feb 2008 17:32:15 +0000 (17:32 +0000)
Lib/re.py

index d7151543f003c80ffaa9b79f3da3000a96f11760..1d9c987c1cdc866f3f66bdb5e56c1ef8d6675e21 100644 (file)
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -300,8 +300,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 = []