Skip to content

Commit

Permalink
pythongh-128691: Use deferred reference counting on _thread._local
Browse files Browse the repository at this point in the history
This change, along with the LOAD_ATTR specializations, makes the
"thread_local_read" micro benchmark in Tools/ftscalingbench/ftscalingbench.py
scale well to multiple threads.
  • Loading branch information
colesbury committed Jan 9, 2025
1 parent 7dc41ad commit a8c2e44
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,7 @@ local_new(PyTypeObject *type, PyObject *args, PyObject *kw)
Py_DECREF(localsdict);
Py_DECREF(sentinel_wr);

_PyObject_SetDeferredRefcount((PyObject *)self);
return (PyObject *)self;

err:
Expand Down

0 comments on commit a8c2e44

Please sign in to comment.