mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
- Fixed bug #672491. This change restores the behavior of lastindex/lastgroup
to be compliant with previous python versions, by backing out the changes made in revision 2.84 which affected this. The bugfix for backtracking is still maintained.
This commit is contained in:
parent
153c9e493e
commit
1aca359e89
1 changed files with 4 additions and 5 deletions
|
@ -879,11 +879,10 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level)
|
|||
/* <MARK> <gid> */
|
||||
TRACE(("|%p|%p|MARK %d\n", pattern, ptr, pattern[0]));
|
||||
i = pattern[0];
|
||||
if (i > state->lastmark) {
|
||||
if (i & 1)
|
||||
state->lastindex = i/2 + 1;
|
||||
if (i > state->lastmark)
|
||||
state->lastmark = i;
|
||||
if (i & 1)
|
||||
state->lastindex = i/2 + 1;
|
||||
}
|
||||
state->mark[i] = ptr;
|
||||
pattern++;
|
||||
break;
|
||||
|
@ -1139,9 +1138,9 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level)
|
|||
if (i)
|
||||
return i;
|
||||
i = mark_restore(state, 0, lastmark);
|
||||
state->lastmark = lastmark;
|
||||
if (i < 0)
|
||||
return i;
|
||||
lastmark_restore(state, lastmark);
|
||||
rp->count = count - 1;
|
||||
state->ptr = ptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue