diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 7e33558dba3e32..08ce172c6a8fcb 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -122,7 +122,6 @@ typedef enum { fut_state prefix##_state; \ int prefix##_log_tb; \ int prefix##_blocking; \ - PyObject *dict; \ PyObject *prefix##_weakreflist; \ PyObject *prefix##_cancelled_exc; @@ -489,7 +488,6 @@ future_init(FutureObj *fut, PyObject *loop) PyObject *res; int is_true; - // Same to FutureObj_clear() but not clearing fut->dict Py_CLEAR(fut->fut_loop); Py_CLEAR(fut->fut_callback0); Py_CLEAR(fut->fut_context0); @@ -814,7 +812,7 @@ FutureObj_clear(FutureObj *fut) Py_CLEAR(fut->fut_source_tb); Py_CLEAR(fut->fut_cancel_msg); Py_CLEAR(fut->fut_cancelled_exc); - Py_CLEAR(fut->dict); + _PyObject_ClearManagedDict((PyObject *)fut); return 0; } @@ -832,7 +830,7 @@ FutureObj_traverse(FutureObj *fut, visitproc visit, void *arg) Py_VISIT(fut->fut_source_tb); Py_VISIT(fut->fut_cancel_msg); Py_VISIT(fut->fut_cancelled_exc); - Py_VISIT(fut->dict); + _PyObject_VisitManagedDict((PyObject *)fut, visit, arg); return 0; } @@ -1502,7 +1500,6 @@ static PyMethodDef FutureType_methods[] = { static PyMemberDef FutureType_members[] = { {"__weaklistoffset__", T_PYSSIZET, offsetof(FutureObj, fut_weakreflist), READONLY}, - {"__dictoffset__", T_PYSSIZET, offsetof(FutureObj, dict), READONLY}, {NULL}, }; @@ -1551,7 +1548,7 @@ static PyType_Spec Future_spec = { .name = "_asyncio.Future", .basicsize = sizeof(FutureObj), .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_IMMUTABLETYPE), + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_MANAGED_DICT), .slots = Future_slots, }; @@ -2183,7 +2180,7 @@ TaskObj_traverse(TaskObj *task, visitproc visit, void *arg) Py_VISIT(fut->fut_source_tb); Py_VISIT(fut->fut_cancel_msg); Py_VISIT(fut->fut_cancelled_exc); - Py_VISIT(fut->dict); + _PyObject_VisitManagedDict((PyObject *)fut, visit, arg); return 0; } @@ -2640,7 +2637,6 @@ static PyMethodDef TaskType_methods[] = { static PyMemberDef TaskType_members[] = { {"__weaklistoffset__", T_PYSSIZET, offsetof(TaskObj, task_weakreflist), READONLY}, - {"__dictoffset__", T_PYSSIZET, offsetof(TaskObj, dict), READONLY}, {NULL}, }; @@ -2677,7 +2673,7 @@ static PyType_Spec Task_spec = { .name = "_asyncio.Task", .basicsize = sizeof(TaskObj), .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_IMMUTABLETYPE), + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_MANAGED_DICT), .slots = Task_slots, };