[Python-checkins] python/dist/src/Modules _sre.c,2.109,2.110
niemeyer at users.sourceforge.net
niemeyer at users.sourceforge.net
Thu Dec 2 17:15:52 CET 2004
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23630/Modules
Modified Files:
_sre.c
Log Message:
Fixing bug #1072259 in SRE.
Index: _sre.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v
retrieving revision 2.109
retrieving revision 2.110
diff -u -d -r2.109 -r2.110
--- _sre.c 24 Sep 2004 04:31:19 -0000 2.109
+++ _sre.c 2 Dec 2004 16:15:39 -0000 2.110
@@ -1024,9 +1024,10 @@
state->ptr = ctx->ptr;
- ctx->count = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]);
- RETURN_ON_ERROR(ctx->count);
-
+ ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]);
+ RETURN_ON_ERROR(ret);
+ DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);
+ ctx->count = ret;
ctx->ptr += ctx->count;
/* when we arrive here, count contains the number of
@@ -1110,13 +1111,14 @@
ctx->count = 0;
else {
/* count using pattern min as the maximum */
- ctx->count = SRE_COUNT(state, ctx->pattern+3,
- ctx->pattern[1]);
- RETURN_ON_ERROR(ctx->count);
- if (ctx->count < (int) ctx->pattern[1])
+ ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[1]);
+ RETURN_ON_ERROR(ret);
+ DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);
+ if (ret < (int) ctx->pattern[1])
/* didn't match minimum number of times */
RETURN_FAILURE;
/* advance past minimum matches of repeat */
+ ctx->count = ret;
ctx->ptr += ctx->count;
}
@@ -1140,6 +1142,7 @@
state->ptr = ctx->ptr;
ret = SRE_COUNT(state, ctx->pattern+3, 1);
RETURN_ON_ERROR(ret);
+ DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);
if (ret == 0)
break;
assert(ret == 1);
More information about the Python-checkins
mailing list