Skip to content

Commit 4000000

Browse files
gvanrossumpull[bot]
authored andcommitted
gh-118074: Immortal executors are not GC-able (#118182)
Better version of gh-118117. Just check for immortality instead of an address range check.
1 parent 2775467 commit 4000000

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Python/optimizer.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,7 @@ executor_traverse(PyObject *o, visitproc visit, void *arg)
397397
static int
398398
executor_is_gc(PyObject *o)
399399
{
400-
if ((PyObject *)&COLD_EXITS[0] <= o && o < (PyObject *)&COLD_EXITS[COLD_EXIT_COUNT]) {
401-
return 0;
402-
}
403-
return 1;
400+
return !_Py_IsImmortal(o);
404401
}
405402

406403
PyTypeObject _PyUOpExecutor_Type = {

0 commit comments

Comments
 (0)