summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2024-04-23 20:38:23 (GMT)
committerGitHub <noreply@github.com>2024-04-23 20:38:23 (GMT)
commit7e87d30f1f30d39c3005e03195f3d7648b38a1e2 (patch)
tree23856edce7465706779d864afde1293372831fc1 /Python
parent258408239a4fe8a14919d81b73a16e2cfa374050 (diff)
downloadcpython-7e87d30f1f30d39c3005e03195f3d7648b38a1e2.zip
cpython-7e87d30f1f30d39c3005e03195f3d7648b38a1e2.tar.gz
cpython-7e87d30f1f30d39c3005e03195f3d7648b38a1e2.tar.bz2
gh-118074: Immortal executors are not GC-able (#118182)
Better version of gh-118117. Just check for immortality instead of an address range check.
Diffstat (limited to 'Python')
-rw-r--r--Python/optimizer.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c
index 5863336..0017965 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -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 = {