summaryrefslogtreecommitdiffstats
path: root/Lib/re.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-11-30 16:49:00 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-11-30 16:49:00 (GMT)
commit66323415c791502aec973cc1b4b755d22b8ba210 (patch)
treeff131b01925be49052e96df80bf7eac88f7a48c7 /Lib/re.py
parentb7138e24e3359810158a88e285aae6f34e8d4255 (diff)
downloadcpython-66323415c791502aec973cc1b4b755d22b8ba210.zip
cpython-66323415c791502aec973cc1b4b755d22b8ba210.tar.gz
cpython-66323415c791502aec973cc1b4b755d22b8ba210.tar.bz2
backout 9fcf4008b626 (#9179) for further consideration
Diffstat (limited to 'Lib/re.py')
-rw-r--r--Lib/re.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/re.py b/Lib/re.py
index 82244db..199afee 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -352,11 +352,10 @@ class Scanner:
s = sre_parse.Pattern()
s.flags = flags
for phrase, action in lexicon:
- gid = s.opengroup()
p.append(sre_parse.SubPattern(s, [
- (SUBPATTERN, (gid, sre_parse.parse(phrase, flags))),
+ (SUBPATTERN, (len(p)+1, sre_parse.parse(phrase, flags))),
]))
- s.closegroup(gid, p[-1])
+ s.groups = len(p)+1
p = sre_parse.SubPattern(s, [(BRANCH, (None, p))])
self.scanner = sre_compile.compile(p)
def scan(self, string):