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 /Python/traceback.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 'Python/traceback.c')
-rw-r--r-- | Python/traceback.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index cdbec2b..cfbd833 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -39,15 +39,9 @@ tb_dealloc(PyTracebackObject *tb) 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 |