diff Objects/methodobject.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 d6d415df0df0
children 6620a510e9a9 13d5e5f0e993
line wrap: on
line diff
--- a/Objects/methodobject.c	Sat Apr 15 21:41:56 2006 +0000
+++ b/Objects/methodobject.c	Sat Apr 15 21:47:09 2006 +0000
@@ -149,17 +149,8 @@
 static int
 meth_traverse(PyCFunctionObject *m, visitproc visit, void *arg)
 {
-	int err;
-	if (m->m_self != NULL) {
-		err = visit(m->m_self, arg);
-		if (err)
-			return err;
-	}
-	if (m->m_module != NULL) {
-		err = visit(m->m_module, arg);
-		if (err)
-			return err;
-	}
+	Py_VISIT(m->m_self);
+	Py_VISIT(m->m_module);
 	return 0;
 }