diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-05-31 19:08:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 19:08:21 (GMT) |
commit | 67ac19111f14e9606454d0f36a52132996073db4 (patch) | |
tree | 839b1fa870e06b7336262cb9f1725c9574040f2a | |
parent | a7e81fdfc175bd9cf82dfd8f1e1853cb942bf0f0 (diff) | |
download | cpython-67ac19111f14e9606454d0f36a52132996073db4.zip cpython-67ac19111f14e9606454d0f36a52132996073db4.tar.gz cpython-67ac19111f14e9606454d0f36a52132996073db4.tar.bz2 |
[3.13] gh-119799: Add missing `_Py_IncRefTotal` to `_Py_NewRefWithLock` (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 879d43b705faab0c59f1a6a0042e286f39f3a4ef)
Co-authored-by: Sam Gross <colesbury@gmail.com>
-rw-r--r-- | Include/internal/pycore_object.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 7602248..f63e1da 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -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); |