summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-05-31 18:18:24 (GMT)
committerGitHub <noreply@github.com>2024-05-31 18:18:24 (GMT)
commit879d43b705faab0c59f1a6a0042e286f39f3a4ef (patch)
tree5f92a279c7c61ee342fca4150635c0dd7af95dd5
parent9bc6045842ebc91ec48ab163a9e1e8644231607c (diff)
downloadcpython-879d43b705faab0c59f1a6a0042e286f39f3a4ef.zip
cpython-879d43b705faab0c59f1a6a0042e286f39f3a4ef.tar.gz
cpython-879d43b705faab0c59f1a6a0042e286f39f3a4ef.tar.bz2
gh-119799: Add missing `_Py_IncRefTotal` to `_Py_NewRefWithLock` (#119800)
The free-threaded refleak builds were reporting negative refcount deltas in some tests because of a missing `_Py_NewRefWithLock`.
-rw-r--r--Include/internal/pycore_object.h3
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);