diff Python/traceback.c @ 37756:7b2e436a4a21 legacy-trunk

Use Py_VISIT in all tp_traverse methods, instead of traversing manually or using a custom, nearly-identical macro. This probably changes how some of these functions are compiled, which may result in fractionally slower (or faster) execution. Considering the nature of traversal, visiting much of the address space in unpredictable patterns, I'd argue the code readability and maintainability is well worth it ;P
author Thomas Wouters <thomas@python.org>
date Sat, 15 Apr 2006 21:47:09 +0000
parents d1547426ab61
children df294bc5ce6e
line wrap: on
line diff
--- a/Python/traceback.c	Sat Apr 15 21:41:56 2006 +0000
+++ b/Python/traceback.c	Sat Apr 15 21:47:09 2006 +0000
@@ -39,15 +39,9 @@
 static int
 tb_traverse(PyTracebackObject *tb, visitproc visit, void *arg)
 {
-	int err = 0;
-	if (tb->tb_next) {
-		err = visit((PyObject *)tb->tb_next, arg);
-		if (err)
-			return err;
-	}
-	if (tb->tb_frame) 
-		err = visit((PyObject *)tb->tb_frame, arg);
-	return err;
+	Py_VISIT(tb->tb_next);
+	Py_VISIT(tb->tb_frame);
+	return 0;
 }
 
 static void