summaryrefslogtreecommitdiff
path: root/Lib/re.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>1998-08-21 18:39:38 +0000
committerAndrew M. Kuchling <amk@amk.ca>1998-08-21 18:39:38 +0000
commit9a80e00cac40dd64709919c29386d8ede39f91d6 (patch)
treec3b9d62576a3db31d17c9eb59e931ffa11dd1e6a /Lib/re.py
parentf7039e29ec1fbeeab3aa786a36a4e33abe055b71 (diff)
downloadcpython-git-9a80e00cac40dd64709919c29386d8ede39f91d6.tar.gz
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().
Diffstat (limited to 'Lib/re.py')
-rw-r--r--Lib/re.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/re.py b/Lib/re.py
index dce29ceac9..d190363df4 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -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