summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/threadmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 81bf288..a87ddb3 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -293,7 +293,10 @@ _ldict(localobject *self)
}
}
- else if (self->dict != ldict) {
+
+ /* The call to tp_init above may have caused another thread to run.
+ Install our ldict again. */
+ if (self->dict != ldict) {
Py_CLEAR(self->dict);
Py_INCREF(ldict);
self->dict = ldict;