mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Documented the new Py_VISIT macro to simplify implementation of
tp_traverse handlers. (Tim made me do it. ;)
This commit is contained in:
parent
8c5aeaa277
commit
aa6389e13b
2 changed files with 33 additions and 0 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue