summaryrefslogtreecommitdiffstats
path: root/Include/objimpl.h
diff options
context:
space:
mode:
authorJim Fulton <jim@zope.com>2004-07-14 19:08:17 (GMT)
committerJim Fulton <jim@zope.com>2004-07-14 19:08:17 (GMT)
commitaa6389e13be460cce1f16f2a525ba8754737d30b (patch)
tree719b5d9c9331896054b9a4f09e5d2e95e086f898 /Include/objimpl.h
parent8c5aeaa2770c958414c0785229a5e038ed97a234 (diff)
downloadcpython-aa6389e13be460cce1f16f2a525ba8754737d30b.zip
cpython-aa6389e13be460cce1f16f2a525ba8754737d30b.tar.gz
cpython-aa6389e13be460cce1f16f2a525ba8754737d30b.tar.bz2
Documented the new Py_VISIT macro to simplify implementation of
tp_traverse handlers. (Tim made me do it. ;)
Diffstat (limited to 'Include/objimpl.h')
-rw-r--r--Include/objimpl.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 3679cba..649d1bc 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -302,6 +302,16 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *);
( (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. */