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().
This commit is contained in:
Andrew M. Kuchling 1998-08-21 18:39:38 +00:00
parent f7039e29ec
commit 9a80e00cac

View file

@ -167,6 +167,7 @@ class RegexObject:
regs = match(source, pos, end, 0)
if not regs:
break
self._num_regs = len(regs)
i, j = regs[0]
if i == j == lastmatch:
# Empty match adjacent to previous match