comparison 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
comparison
equal deleted inserted replaced
37755:b7373bc3b09f 37756:7b2e436a4a21
37 } 37 }
38 38
39 static int 39 static int
40 tb_traverse(PyTracebackObject *tb, visitproc visit, void *arg) 40 tb_traverse(PyTracebackObject *tb, visitproc visit, void *arg)
41 { 41 {
42 int err = 0; 42 Py_VISIT(tb->tb_next);
43 if (tb->tb_next) { 43 Py_VISIT(tb->tb_frame);
44 err = visit((PyObject *)tb->tb_next, arg); 44 return 0;
45 if (err)
46 return err;
47 }
48 if (tb->tb_frame)
49 err = visit((PyObject *)tb->tb_frame, arg);
50 return err;
51 } 45 }
52 46
53 static void 47 static void
54 tb_clear(PyTracebackObject *tb) 48 tb_clear(PyTracebackObject *tb)
55 { 49 {