Counting for signal checking now continues in new match from the point where
it ended in the previous match instead of starting from 0.
(cherry picked from commit
8ac2085b80eca4d9b2a1093d0a7da020fd12e11a)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
--- /dev/null
+:mod:`re` functions such as :func:`re.findall`, :func:`re.split`,
+:func:`re.search` and :func:`re.sub` which perform short repeated matches
+can now be interrupted by user.
size_t data_stack_base;
/* current repeat context */
SRE_REPEAT *repeat;
+ unsigned int sigcount;
} SRE_STATE;
typedef struct {
Py_ssize_t alloc_pos, ctx_pos = -1;
Py_ssize_t ret = 0;
int jump;
- unsigned int sigcount=0;
+ unsigned int sigcount = state->sigcount;
SRE(match_context)* ctx;
SRE(match_context)* nextctx;
ctx_pos = ctx->last_ctx_pos;
jump = ctx->jump;
DATA_POP_DISCARD(ctx);
- if (ctx_pos == -1)
+ if (ctx_pos == -1) {
+ state->sigcount = sigcount;
return ret;
+ }
DATA_LOOKUP_AT(SRE(match_context), ctx, ctx_pos);
switch (jump) {