GH-125174: Make immortal objects more robust, following design from PEP 683 (GH-125251)

This commit is contained in:
Mark Shannon 2024-10-10 18:19:08 +01:00 committed by GitHub
parent 01fc3b34cc
commit c9014374c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 61 additions and 72 deletions

View file

@ -381,7 +381,7 @@ dummy_func(
EXIT_IF(!PyLong_CheckExact(value_o));
STAT_INC(TO_BOOL, hit);
if (_PyLong_IsZero((PyLongObject *)value_o)) {
assert(_Py_IsImmortalLoose(value_o));
assert(_Py_IsImmortal(value_o));
DEAD(value);
res = PyStackRef_False;
}
@ -412,7 +412,7 @@ dummy_func(
EXIT_IF(!PyUnicode_CheckExact(value_o));
STAT_INC(TO_BOOL, hit);
if (value_o == &_Py_STR(empty)) {
assert(_Py_IsImmortalLoose(value_o));
assert(_Py_IsImmortal(value_o));
DEAD(value);
res = PyStackRef_False;
}