diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2004-12-02 16:36:29 (GMT) |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2004-12-02 16:36:29 (GMT) |
commit | e1311180ef8cb5b9e1edfc9b54f88926a5559245 (patch) | |
tree | 6b25db14cd15dedf6de11228fe9c957a6ee8641e /Modules | |
parent | 5a5bbfb2d4049ae50349e0eda791c1161080c68d (diff) | |
download | cpython-e1311180ef8cb5b9e1edfc9b54f88926a5559245.zip cpython-e1311180ef8cb5b9e1edfc9b54f88926a5559245.tar.gz cpython-e1311180ef8cb5b9e1edfc9b54f88926a5559245.tar.bz2 |
Fixing bug #1072259 of SRE into release24-maint.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sre.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index f4456b5..f97cb62 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -1024,9 +1024,10 @@ entrance: 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 @@ entrance: 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 @@ entrance: 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); |