]> granicus.if.org Git - python/commitdiff
Replace assert() with a more informative fatal error.
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 23 Jun 2012 22:30:12 +0000 (00:30 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 23 Jun 2012 22:30:12 +0000 (00:30 +0200)
Objects/typeobject.c

index 88b23c51e15c871d571d19e8ff3951547d7ffda6..dff47f371fa0afb0585c02833fa716172c10e603 100644 (file)
@@ -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);