Mailing List Archive

gh-118074: Immortal executors are not GC-able (#118182)
https://github.com/python/cpython/commit/7e87d30f1f30d39c3005e03195f3d7648b38a1e2
commit: 7e87d30f1f30d39c3005e03195f3d7648b38a1e2
branch: main
author: Guido van Rossum <guido@python.org>
committer: gvanrossum <gvanrossum@gmail.com>
date: 2024-04-23T13:38:23-07:00
summary:

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

Better version of gh-118117.
Just check for immortality instead of an address range check.

files:
M Python/optimizer.c

diff --git a/Python/optimizer.c b/Python/optimizer.c
index 5863336c0d9ecf..0017965c32f290 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 = {

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-leave@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: list-python-checkins@lists.gossamer-threads.com