]> granicus.if.org Git - python/commitdiff
- Fixed bug #672491. This change restores the behavior of lastindex/lastgroup
authorGustavo Niemeyer <gustavo@niemeyer.net>
Sun, 20 Apr 2003 00:45:13 +0000 (00:45 +0000)
committerGustavo Niemeyer <gustavo@niemeyer.net>
Sun, 20 Apr 2003 00:45:13 +0000 (00:45 +0000)
  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

index 8cae095c8a77689bed8bc90ea6b9671bc9cd5aae..be591127bdf4430f1d567ad3f6213d2d3739c866 100644 (file)
@@ -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;
             }