diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2023-05-05 00:00:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-05 00:00:07 (GMT) |
commit | ce871fdc3a02e8441ad73b13f9fced308a9d9ad1 (patch) | |
tree | 2f0cda4ab28073d7e39bbdbeda3196002d87699d /Include | |
parent | fa86a77589a06661fcebb806d36f3a7450e2aecf (diff) | |
download | cpython-ce871fdc3a02e8441ad73b13f9fced308a9d9ad1.zip cpython-ce871fdc3a02e8441ad73b13f9fced308a9d9ad1.tar.gz cpython-ce871fdc3a02e8441ad73b13f9fced308a9d9ad1.tar.bz2 |
GH-104142: Fix _Py_RefcntAdd to respect immortality (GH-104143)
Diffstat (limited to 'Include')
-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 b9e700e..500b3ee 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -58,6 +58,9 @@ extern void _Py_DecRefTotal(PyInterpreterState *); // Increment reference count by n static inline void _Py_RefcntAdd(PyObject* op, Py_ssize_t n) { + if (_Py_IsImmortal(op)) { + return; + } #ifdef Py_REF_DEBUG _Py_AddRefTotal(_PyInterpreterState_GET(), n); #endif |