summaryrefslogtreecommitdiffstats
path: root/Modules/_sre
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_sre')
-rw-r--r--Modules/_sre/sre.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_sre/sre.c b/Modules/_sre/sre.c
index 2f1c732..ace2e9b 100644
--- a/Modules/_sre/sre.c
+++ b/Modules/_sre/sre.c
@@ -1462,6 +1462,9 @@ _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
for (i = 0; i < n; i++) {
PyObject *o = PyList_GET_ITEM(code, i);
unsigned long value = PyLong_AsUnsignedLong(o);
+ if (value == (unsigned long)-1 && PyErr_Occurred()) {
+ break;
+ }
self->code[i] = (SRE_CODE) value;
if ((unsigned long) self->code[i] != value) {
PyErr_SetString(PyExc_OverflowError,