[issue1662] [patch] assert tp_traverse in PyType_GenericAlloc()
STINNER Victor
report at bugs.python.org
Mon Jun 28 21:30:14 EDT 2021
STINNER Victor <vstinner at python.org> added the comment:
This issue was fixed differently in bpo-44263, by adding a test in PyType_Ready():
// bpo-44263: tp_traverse is required if Py_TPFLAGS_HAVE_GC is set.
// Note: tp_clear is optional.
if (type->tp_flags & Py_TPFLAGS_HAVE_GC
&& type->tp_traverse == NULL)
{
PyErr_Format(PyExc_SystemError,
"type %s has the Py_TPFLAGS_HAVE_GC flag "
"but has no traverse function",
type->tp_name);
return -1;
}
commit ee7637596d8de25f54261bbeabc602d31e74f482
Author: Victor Stinner <vstinner at python.org>
Date: Tue Jun 1 23:37:12 2021 +0200
bpo-44263: Py_TPFLAGS_HAVE_GC requires tp_traverse (GH-26463)
The PyType_Ready() function now raises an error if a type is defined
with the Py_TPFLAGS_HAVE_GC flag set but has no traverse function
(PyTypeObject.tp_traverse).
----------
nosy: +vstinner
resolution: rejected -> fixed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue1662>
_______________________________________
More information about the Python-bugs-list
mailing list