Commit 9a80e00c authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

The .subn() method wasn't setting _num_regs, which is used by the .groups()

	method, so .groups() didn't work inside the replacement function
	called by re.sub.  One-line fix: set self._num_regs inside subn().
parent f7039e29
...@@ -167,6 +167,7 @@ class RegexObject: ...@@ -167,6 +167,7 @@ class RegexObject:
regs = match(source, pos, end, 0) regs = match(source, pos, end, 0)
if not regs: if not regs:
break break
self._num_regs = len(regs)
i, j = regs[0] i, j = regs[0]
if i == j == lastmatch: if i == j == lastmatch:
# Empty match adjacent to previous match # Empty match adjacent to previous match
......
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