Commit 1aca359e authored by Gustavo Niemeyer's avatar Gustavo Niemeyer

- 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.
parent 153c9e49
...@@ -879,11 +879,10 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) ...@@ -879,11 +879,10 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level)
/* <MARK> <gid> */ /* <MARK> <gid> */
TRACE(("|%p|%p|MARK %d\n", pattern, ptr, pattern[0])); TRACE(("|%p|%p|MARK %d\n", pattern, ptr, pattern[0]));
i = pattern[0]; i = pattern[0];
if (i > state->lastmark) {
state->lastmark = i;
if (i & 1) if (i & 1)
state->lastindex = i/2 + 1; state->lastindex = i/2 + 1;
} if (i > state->lastmark)
state->lastmark = i;
state->mark[i] = ptr; state->mark[i] = ptr;
pattern++; pattern++;
break; break;
...@@ -1139,9 +1138,9 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) ...@@ -1139,9 +1138,9 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level)
if (i) if (i)
return i; return i;
i = mark_restore(state, 0, lastmark); i = mark_restore(state, 0, lastmark);
state->lastmark = lastmark;
if (i < 0) if (i < 0)
return i; return i;
lastmark_restore(state, lastmark);
rp->count = count - 1; rp->count = count - 1;
state->ptr = ptr; state->ptr = ptr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment