Skip to content
Closed
Changes from all commits
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
9 changes: 9 additions & 0 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4709,6 +4709,15 @@ _PyType_FromMetaclass_impl(
}
}

if (!(type->tp_flags & Py_TPFLAGS_HAVE_GC)
|| type->tp_traverse == NULL)
{
if (PyErr_WarnFormat(PyExc_RuntimeError, 1,
"heap type %N should implement tp_traverse and visit their type",
type)) {
goto finally;
}
}
assert(_PyType_CheckConsistency(type));

finally:
Expand Down