diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2003-04-20 00:45:13 +0000 |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2003-04-20 00:45:13 +0000 |
commit | 1aca359e895d6cc8cc366fd8d8d0edbef13a5a13 (patch) | |
tree | c30e613564f1d61b55077400a1f320370fe0e81f /Modules/_sre.c | |
parent | 153c9e493e9850340fd686ab7a6e5c176953abd7 (diff) | |
download | cpython-git-1aca359e895d6cc8cc366fd8d8d0edbef13a5a13.tar.gz |
- 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.
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r-- | Modules/_sre.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 8cae095c8a..be591127bd 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -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; } |