diff options
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index 030138d..a4d493f 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -242,6 +242,7 @@ tstate_delete_common(PyThreadState *tstate) { PyInterpreterState *interp; PyThreadState **p; + PyThreadState *prev_p = NULL; if (tstate == NULL) Py_FatalError("PyThreadState_Delete: NULL tstate"); interp = tstate->interp; @@ -254,6 +255,15 @@ tstate_delete_common(PyThreadState *tstate) "PyThreadState_Delete: invalid tstate"); if (*p == tstate) break; + if (*p == prev_p) + Py_FatalError( + "PyThreadState_Delete: small circular list(!)" + " and tstate not found."); + prev_p = *p; + if ((*p)->next == interp->tstate_head) + Py_FatalError( + "PyThreadState_Delete: circular list(!) and" + " tstate not found."); } *p = tstate->next; HEAD_UNLOCK(); |