mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
GH-118074: Executors in the COLD_EXITS array are not GC'able (#118117)
This commit is contained in:
parent
fc21c7f7a7
commit
1b85b3424c
2 changed files with 12 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
||||||
|
Make sure that the Executor objects in the COLD_EXITS array aren't assumed
|
||||||
|
to be GC-able (which would access bytes outside the object).
|
||||||
|
|
@ -394,6 +394,15 @@ executor_traverse(PyObject *o, visitproc visit, void *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
executor_is_gc(PyObject *o)
|
||||||
|
{
|
||||||
|
if ((PyObject *)&COLD_EXITS[0] <= o && o < (PyObject *)&COLD_EXITS[COLD_EXIT_COUNT]) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
PyTypeObject _PyUOpExecutor_Type = {
|
PyTypeObject _PyUOpExecutor_Type = {
|
||||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||||
.tp_name = "uop_executor",
|
.tp_name = "uop_executor",
|
||||||
|
|
@ -405,6 +414,7 @@ PyTypeObject _PyUOpExecutor_Type = {
|
||||||
.tp_methods = executor_methods,
|
.tp_methods = executor_methods,
|
||||||
.tp_traverse = executor_traverse,
|
.tp_traverse = executor_traverse,
|
||||||
.tp_clear = executor_clear,
|
.tp_clear = executor_clear,
|
||||||
|
.tp_is_gc = executor_is_gc,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TO DO -- Generate these tables */
|
/* TO DO -- Generate these tables */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue