summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-06-23 22:30:12 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-06-23 22:30:12 (GMT)
commit1351ca6e66abe2593687bb35235ad71cf6da66a1 (patch)
tree0d4aa5300d7b321ae85f64d22a8fba371340598e
parentad2c43b6871882c3fc2239dfd899b86157f5b27c (diff)
downloadcpython-1351ca6e66abe2593687bb35235ad71cf6da66a1.zip
cpython-1351ca6e66abe2593687bb35235ad71cf6da66a1.tar.gz
cpython-1351ca6e66abe2593687bb35235ad71cf6da66a1.tar.bz2
Replace assert() with a more informative fatal error.
-rw-r--r--Objects/typeobject.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 88b23c5..dff47f3 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);