mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
patch for re.sub bug, by AMK.
This commit is contained in:
parent
193338afeb
commit
816671c666
3 changed files with 7 additions and 6 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue