Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-118997: Fix _Py_ClearImmortal() assertion
Fix _Py_ClearImmortal() assertion: use _Py_IsImmortal() to tolerate
reference count lower than _Py_IMMORTAL_REFCNT. Fix the assertion for
the stable ABI, when a C extension is built with Python 3.11 or
lower.
  • Loading branch information
vstinner committed May 13, 2024
commit 947c1b7bffd873dc748d00700ce87f9fffc725d1
2 changes: 1 addition & 1 deletion Include/internal/pycore_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static inline void _Py_SetImmortal(PyObject *op)
static inline void _Py_ClearImmortal(PyObject *op)
{
if (op) {
assert(op->ob_refcnt == _Py_IMMORTAL_REFCNT);
assert(_Py_IsImmortal(op));
op->ob_refcnt = 1;
Py_DECREF(op);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix _Py_ClearImmortal() assertion: use _Py_IsImmortal() to tolerate
reference count lower than _Py_IMMORTAL_REFCNT. Fix the assertion for the
stable ABI, when a C extension is built with Python 3.11 or lower. Patch by
Victor Stinner.