diff -r 6f77eb5311b5 Modules/_sre.c --- a/Modules/_sre.c Mon Oct 29 21:23:01 2007 +0100 +++ b/Modules/_sre.c Fri Nov 02 22:30:42 2007 +0100 @@ -99,6 +99,7 @@ static char copyright[] = #define SRE_ERROR_STATE -2 /* illegal state */ #define SRE_ERROR_RECURSION_LIMIT -3 /* runaway recursion */ #define SRE_ERROR_MEMORY -9 /* out of memory */ +#define SRE_ERROR_INTERRUPTED -10 /* signal handler raised exception */ #if defined(VERBOSE) #define TRACE(v) printf v @@ -837,9 +838,10 @@ entrance: } for (;;) { + if (PyErr_CheckSignals()) RETURN_ERROR(SRE_ERROR_INTERRUPTED); switch (*ctx->pattern++) { - + case SRE_OP_MARK: /* set mark */ /* */ @@ -1834,6 +1836,9 @@ pattern_error(int status) case SRE_ERROR_MEMORY: PyErr_NoMemory(); break; + case SRE_ERROR_INTERRUPTED: + /* An exception has already been raised, so let it fly */ + break; default: /* other error codes indicate compiler/engine bugs */ PyErr_SetString(