From 1aca359e895d6cc8cc366fd8d8d0edbef13a5a13 Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Sun, 20 Apr 2003 00:45:13 +0000 Subject: - 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. --- Modules/_sre.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Modules/_sre.c b/Modules/_sre.c index 8cae095..be59112 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -879,11 +879,10 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) /* */ 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; } -- cgit v0.12