diff options
| author | Sam Gross <colesbury@gmail.com> | 2024-04-08 16:11:36 (GMT) | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-08 16:11:36 (GMT) | 
| commit | 1a6594f66166206b08f24c3ba633c85f86f99a56 (patch) | |
| tree | 961c4d6e2f694e482636643993cd17ebbf9ea2fd /Python/gc_free_threading.c | |
| parent | 2067da25796ea3254d0edf61a39bcc0326c4f71d (diff) | |
| download | cpython-1a6594f66166206b08f24c3ba633c85f86f99a56.zip cpython-1a6594f66166206b08f24c3ba633c85f86f99a56.tar.gz cpython-1a6594f66166206b08f24c3ba633c85f86f99a56.tar.bz2 | |
gh-117439: Make refleak checking thread-safe without the GIL (#117469)
This keeps track of the per-thread total reference count operations in
PyThreadState in the free-threaded builds. The count is merged into the
interpreter's total when the thread exits.
Diffstat (limited to 'Python/gc_free_threading.c')
| -rw-r--r-- | Python/gc_free_threading.c | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c index 7e4137a..111632f 100644 --- a/Python/gc_free_threading.c +++ b/Python/gc_free_threading.c @@ -168,7 +168,7 @@ merge_refcount(PyObject *op, Py_ssize_t extra)      refcount += extra;  #ifdef Py_REF_DEBUG -    _Py_AddRefTotal(_PyInterpreterState_GET(), extra); +    _Py_AddRefTotal(_PyThreadState_GET(), extra);  #endif      // No atomics necessary; all other threads in this interpreter are paused. @@ -307,7 +307,7 @@ merge_queued_objects(_PyThreadStateImpl *tstate, struct collection_state *state)              // decref and deallocate the object once we start the world again.              op->ob_ref_shared += (1 << _Py_REF_SHARED_SHIFT);  #ifdef Py_REF_DEBUG -            _Py_IncRefTotal(_PyInterpreterState_GET()); +            _Py_IncRefTotal(_PyThreadState_GET());  #endif              worklist_push(&state->objs_to_decref, op);          } | 
