summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index c841eb3..9479256 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -291,6 +291,10 @@ tstate_delete_common(PyThreadState *tstate)
"PyThreadState_Delete: invalid tstate");
if (*p == tstate)
break;
+ /* Sanity check. These states should never happen but if
+ * they do we must abort. Otherwise we'll end up spinning in
+ * in a tight loop with the lock held. A similar check is done
+ * in thread.c find_key(). */
if (*p == prev_p)
Py_FatalError(
"PyThreadState_Delete: small circular list(!)"