gh-118074: Immortal executors are not GC-able (#118182)

Better version of gh-118117.
Just check for immortality instead of an address range check.
This commit is contained in:
Guido van Rossum 2024-04-23 13:38:23 -07:00 committed by GitHub
parent 258408239a
commit 7e87d30f1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 4 deletions

View File

@ -397,10 +397,7 @@ executor_traverse(PyObject *o, visitproc visit, void *arg)
static int
executor_is_gc(PyObject *o)
{
if ((PyObject *)&COLD_EXITS[0] <= o && o < (PyObject *)&COLD_EXITS[COLD_EXIT_COUNT]) {
return 0;
}
return 1;
return !_Py_IsImmortal(o);
}
PyTypeObject _PyUOpExecutor_Type = {