diff options
author | Thomas Wouters <thomas@python.org> | 2006-04-15 21:47:09 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-04-15 21:47:09 (GMT) |
commit | c6e55068cad6f2178981eec4f0a0a583b8bba21a (patch) | |
tree | 19a89bbe082dadc70c1413030e5a5b8dacac757c /Modules/operator.c | |
parent | 447d095976fd532bf1882bf7afeb52473ff8673c (diff) | |
download | cpython-c6e55068cad6f2178981eec4f0a0a583b8bba21a.zip cpython-c6e55068cad6f2178981eec4f0a0a583b8bba21a.tar.gz cpython-c6e55068cad6f2178981eec4f0a0a583b8bba21a.tar.bz2 |
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
Diffstat (limited to 'Modules/operator.c')
-rw-r--r-- | Modules/operator.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/operator.c b/Modules/operator.c index 53144f1..25b3999 100644 --- a/Modules/operator.c +++ b/Modules/operator.c @@ -358,8 +358,7 @@ itemgetter_dealloc(itemgetterobject *ig) static int itemgetter_traverse(itemgetterobject *ig, visitproc visit, void *arg) { - if (ig->item) - return visit(ig->item, arg); + Py_VISIT(ig->item); return 0; } @@ -497,8 +496,7 @@ attrgetter_dealloc(attrgetterobject *ag) static int attrgetter_traverse(attrgetterobject *ag, visitproc visit, void *arg) { - if (ag->attr) - return visit(ag->attr, arg); + Py_VISIT(ag->attr); return 0; } |