Skip to content

[3.12] gh-118997: Fix _Py_ClearImmortal() assertion #119001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2024
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
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.
Loading