mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
GH-125174: Make immortal objects more robust, following design from PEP 683 (GH-125251)
This commit is contained in:
parent
01fc3b34cc
commit
c9014374c5
17 changed files with 61 additions and 72 deletions
|
@ -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;
|
||||
}
|
||||
|
|
4
Python/executor_cases.c.h
generated
4
Python/executor_cases.c.h
generated
|
@ -402,7 +402,7 @@
|
|||
}
|
||||
STAT_INC(TO_BOOL, hit);
|
||||
if (_PyLong_IsZero((PyLongObject *)value_o)) {
|
||||
assert(_Py_IsImmortalLoose(value_o));
|
||||
assert(_Py_IsImmortal(value_o));
|
||||
res = PyStackRef_False;
|
||||
}
|
||||
else {
|
||||
|
@ -455,7 +455,7 @@
|
|||
}
|
||||
STAT_INC(TO_BOOL, hit);
|
||||
if (value_o == &_Py_STR(empty)) {
|
||||
assert(_Py_IsImmortalLoose(value_o));
|
||||
assert(_Py_IsImmortal(value_o));
|
||||
res = PyStackRef_False;
|
||||
}
|
||||
else {
|
||||
|
|
4
Python/generated_cases.c.h
generated
4
Python/generated_cases.c.h
generated
|
@ -7840,7 +7840,7 @@
|
|||
DEOPT_IF(!PyLong_CheckExact(value_o), TO_BOOL);
|
||||
STAT_INC(TO_BOOL, hit);
|
||||
if (_PyLong_IsZero((PyLongObject *)value_o)) {
|
||||
assert(_Py_IsImmortalLoose(value_o));
|
||||
assert(_Py_IsImmortal(value_o));
|
||||
res = PyStackRef_False;
|
||||
}
|
||||
else {
|
||||
|
@ -7902,7 +7902,7 @@
|
|||
DEOPT_IF(!PyUnicode_CheckExact(value_o), TO_BOOL);
|
||||
STAT_INC(TO_BOOL, hit);
|
||||
if (value_o == &_Py_STR(empty)) {
|
||||
assert(_Py_IsImmortalLoose(value_o));
|
||||
assert(_Py_IsImmortal(value_o));
|
||||
res = PyStackRef_False;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1051,7 +1051,7 @@ del_cached_def(struct extensions_cache_value *value)
|
|||
However, this decref would be problematic if the module def were
|
||||
dynamically allocated, it were the last ref, and this function
|
||||
were called with an interpreter other than the def's owner. */
|
||||
assert(value->def == NULL || _Py_IsImmortalLoose(value->def));
|
||||
assert(value->def == NULL || _Py_IsImmortal(value->def));
|
||||
|
||||
Py_XDECREF(value->def->m_base.m_copy);
|
||||
value->def->m_base.m_copy = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue