diff Objects/weakrefobject.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 79a0f080f898
children 1fdf29a88f0e
line wrap: on
line diff
--- a/Objects/weakrefobject.c	Sat Apr 15 21:41:56 2006 +0000
+++ b/Objects/weakrefobject.c	Sat Apr 15 21:47:09 2006 +0000
@@ -109,8 +109,7 @@
 static int
 gc_traverse(PyWeakReference *self, visitproc visit, void *arg)
 {
-    if (self->wr_callback != NULL)
-        return visit(self->wr_callback, arg);
+    Py_VISIT(self->wr_callback);
     return 0;
 }