From e5a3388c646b7c22ad8754dc9c9d3bde8ebe1bb4 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Mon, 27 Feb 2006 17:15:31 +0000 Subject: Patch 1413181, by Gabriel Becedillas. PyThreadState_Delete(): if the auto-GIL-state machinery knows about the thread state, forget it (since the thread state is being deleted, continuing to remember it can't help, but can hurt if another thread happens to get created with the same thread id). I'll backport to 2.4 next. --- Python/pystate.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Python/pystate.c') diff --git a/Python/pystate.c b/Python/pystate.c index 6584cda775..867334e81e 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -262,6 +262,10 @@ PyThreadState_Delete(PyThreadState *tstate) if (tstate == _PyThreadState_Current) Py_FatalError("PyThreadState_Delete: tstate is still current"); tstate_delete_common(tstate); +#ifdef WITH_THREAD + if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate) + PyThread_delete_key_value(autoTLSkey); +#endif /* WITH_THREAD */ } -- cgit v1.2.1