summaryrefslogtreecommitdiffstats
path: root/Modules/pcremodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-10 04:55:29 (GMT)
committerGuido van Rossum <guido@python.org>1998-03-10 04:55:29 (GMT)
commit816671c66641fe0b115c82a98efc5cdb693c235c (patch)
treed298272eec9e9a6baca97735fb19246e2733b2cc /Modules/pcremodule.c
parent193338afeb42c591b24d74939bff1715ba4671c5 (diff)
downloadcpython-816671c66641fe0b115c82a98efc5cdb693c235c.zip
cpython-816671c66641fe0b115c82a98efc5cdb693c235c.tar.gz
cpython-816671c66641fe0b115c82a98efc5cdb693c235c.tar.bz2
patch for re.sub bug, by AMK.
Diffstat (limited to 'Modules/pcremodule.c')
-rw-r--r--Modules/pcremodule.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/pcremodule.c b/Modules/pcremodule.c
index c1a1523..c4890df 100644
--- a/Modules/pcremodule.c
+++ b/Modules/pcremodule.c
@@ -115,7 +115,7 @@ PyPcre_exec(self, args)
return NULL;
if (endpos == -1) {endpos = stringlen;}
count = pcre_exec(self->regex, self->regex_extra,
- (char *)string+pos, endpos - pos, options,
+ (char *)string, endpos, pos, options,
offsets, sizeof(offsets)/sizeof(int) );
/* If an error occurred during the match, and an exception was raised,
just return NULL and leave the exception alone. The most likely
@@ -143,8 +143,6 @@ PyPcre_exec(self, args)
/* If the group wasn't affected by the match, return -1, -1 */
if (start<0 || count<=i)
{start=end=-1;}
- else
- {start += pos; end +=pos;}
v=Py_BuildValue("ii", start, end);
if (v==NULL) {Py_DECREF(list); return NULL;}
PyList_SetItem(list, i, v);