summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_threadmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 2cbdfeb..d19ae32 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1414,6 +1414,10 @@ local_new(PyTypeObject *type, PyObject *args, PyObject *kw)
return NULL;
}
+ // gh-128691: Use deferred reference counting for thread-locals to avoid
+ // contention on the shared object.
+ _PyObject_SetDeferredRefcount((PyObject *)self);
+
self->args = Py_XNewRef(args);
self->kw = Py_XNewRef(kw);