Mercurial > cpython-lru_cache-weakref
diff Include/objimpl.h @ 32671:52beafd936c8 legacy-trunk
Documented the new Py_VISIT macro to simplify implementation of
tp_traverse handlers. (Tim made me do it. ;)
| author | Jim Fulton <jim@zope.com> |
|---|---|
| date | Wed, 14 Jul 2004 19:08:17 +0000 |
| parents | 7fda09f751ad |
| children | cada2e9b685c |
line wrap: on
line diff
--- a/Include/objimpl.h Wed Jul 14 19:07:35 2004 +0000 +++ b/Include/objimpl.h Wed Jul 14 19:08:17 2004 +0000 @@ -302,6 +302,16 @@ ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) +/* Utility macro to help write tp_traverse functions */ +#define Py_VISIT(op) \ + do { \ + if (op) { \ + int vret = visit((op), arg); \ + if (vret) \ + return vret; \ + } \ + } while (0) + /* This is here for the sake of backwards compatibility. Extensions that * use the old GC API will still compile but the objects will not be * tracked by the GC. */
