Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1351ca6

Browse files
committed
Replace assert() with a more informative fatal error.
1 parent ad2c43b commit 1351ca6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Objects/typeobject.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2858,7 +2858,12 @@ type_traverse(PyTypeObject *type, visitproc visit, void *arg)
28582858
{
28592859
/* Because of type_is_gc(), the collector only calls this
28602860
for heaptypes. */
2861-
assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE);
2861+
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
2862+
char msg[200];
2863+
sprintf(msg, "type_traverse() called for non-heap type '%.100s'",
2864+
type->tp_name);
2865+
Py_FatalError(msg);
2866+
}
28622867

28632868
Py_VISIT(type->tp_dict);
28642869
Py_VISIT(type->tp_cache);

0 commit comments

Comments
 (0)