Skip to content

Commit

Permalink
[3.13] gh-119799: Add missing _Py_IncRefTotal to `_Py_NewRefWithLoc…
Browse files Browse the repository at this point in the history
…k` (GH-119800) (#119878)

The free-threaded refleak builds were reporting negative refcount deltas
in some tests because of a missing `_Py_NewRefWithLock`.
(cherry picked from commit 879d43b)

Co-authored-by: Sam Gross <colesbury@gmail.com>
  • Loading branch information
miss-islington and colesbury authored May 31, 2024
1 parent a7e81fd commit 67ac191
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Include/internal/pycore_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ _Py_NewRefWithLock(PyObject *op)
if (_Py_TryIncrefFast(op)) {
return op;
}
#ifdef Py_REF_DEBUG
_Py_IncRefTotal(_PyThreadState_GET());
#endif
_Py_INCREF_STAT_INC();
for (;;) {
Py_ssize_t shared = _Py_atomic_load_ssize_relaxed(&op->ob_ref_shared);
Expand Down

0 comments on commit 67ac191

Please sign in to comment.