Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix gc
  • Loading branch information
kumaraditya303 authored Feb 8, 2022
commit 6bf3caa0e7483b28f97802f02606a844c33bff57
12 changes: 11 additions & 1 deletion Objects/genericaliasobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,24 @@ ga_iternext(gaiterobject *gi) {
static void
ga_iter_dealloc(gaiterobject *gi) {
PyObject_GC_UnTrack(gi);
Py_XDECREF(gi->obj);
PyObject_GC_Del(gi);
Comment thread
mrahtz marked this conversation as resolved.
}

static int
ga_iter_traverse(gaiterobject *gi, visitproc visit, void *arg)
{
Py_VISIT(gi->obj);
return 0;
}

static PyTypeObject Py_GenericAliasIterType = {
Comment thread
mrahtz marked this conversation as resolved.
PyVarObject_HEAD_INIT(&PyType_Type, 0)
.tp_name = "generic_alias_iter",
.tp_name = "generic_alias_iterator",
.tp_basicsize = sizeof(gaiterobject),
.tp_iter = PyObject_SelfIter,
.tp_iternext = (iternextfunc)ga_iternext,
.tp_traverse = (traverseproc)ga_iter_traverse,
.tp_dealloc = (destructor)ga_iter_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
};
Expand Down