From: Antoine Pitrou Date: Sat, 23 Jun 2012 22:30:12 +0000 (+0200) Subject: Replace assert() with a more informative fatal error. X-Git-Tag: v3.3.0b1~99 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1351ca6e66abe2593687bb35235ad71cf6da66a1;p=python Replace assert() with a more informative fatal error. --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 88b23c51e1..dff47f371f 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2858,7 +2858,12 @@ type_traverse(PyTypeObject *type, visitproc visit, void *arg) { /* Because of type_is_gc(), the collector only calls this for heaptypes. */ - assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE); + if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { + char msg[200]; + sprintf(msg, "type_traverse() called for non-heap type '%.100s'", + type->tp_name); + Py_FatalError(msg); + } Py_VISIT(type->tp_dict); Py_VISIT(type->tp_cache);