summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-07-23 16:24:24 (GMT)
committerGitHub <noreply@github.com>2024-07-23 16:24:24 (GMT)
commitc908d1f87d287a4b3ec58c85b692a7eb617fa6ea (patch)
treef0ad1ea303566363fbfdd9a9cbbd2cb5fa0e6351 /Objects
parent2c1b1e7a07eba0138b9858c6f2bea3cae9af0808 (diff)
downloadcpython-c908d1f87d287a4b3ec58c85b692a7eb617fa6ea.zip
cpython-c908d1f87d287a4b3ec58c85b692a7eb617fa6ea.tar.gz
cpython-c908d1f87d287a4b3ec58c85b692a7eb617fa6ea.tar.bz2
gh-120974: Use common freelist code in asyncio (#122132)
This refactors asyncio to use the common freelist helper functions and macros. As a side effect, the freelist for _asyncio.Future is now re-enabled in the free-threaded build.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 6d6bb87..8a648a4 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -829,7 +829,9 @@ static void
free_object(void *obj)
{
PyObject *op = (PyObject *)obj;
- Py_TYPE(op)->tp_free(op);
+ PyTypeObject *tp = Py_TYPE(op);
+ tp->tp_free(op);
+ Py_DECREF(tp);
}
#endif
@@ -851,6 +853,7 @@ _PyObject_ClearFreeLists(struct _Py_freelists *freelists, int is_finalization)
clear_freelist(&freelists->contexts, is_finalization, free_object);
clear_freelist(&freelists->async_gens, is_finalization, free_object);
clear_freelist(&freelists->async_gen_asends, is_finalization, free_object);
+ clear_freelist(&freelists->futureiters, is_finalization, free_object);
if (is_finalization) {
// Only clear object stack chunks during finalization. We use object
// stacks during GC, so emptying the free-list is counterproductive.