From 7f11924122c3d997a7aedb02324d8c1ccec7a00d Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 15 Jan 2016 13:32:50 +0100 Subject: [PATCH] Doc/c-api: Clarify that Py_VISIT(NULL) does nothing --- Doc/c-api/gcsupport.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/gcsupport.rst b/Doc/c-api/gcsupport.rst index 9f6ad85..284f079 100644 --- a/Doc/c-api/gcsupport.rst +++ b/Doc/c-api/gcsupport.rst @@ -126,9 +126,9 @@ must name its arguments exactly *visit* and *arg*: .. c:function:: void Py_VISIT(PyObject *o) - Call the *visit* callback, with arguments *o* and *arg*. If *visit* returns - a non-zero value, then return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse` - handlers look like:: + If *o* is not NULL, call the *visit* callback, with arguments *o* and *arg*. + If *visit* returns a non-zero value, then return it. + Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers look like:: static int my_traverse(Noddy *self, visitproc visit, void *arg) @@ -138,6 +138,8 @@ must name its arguments exactly *visit* and *arg*: return 0; } + If *o* is NULL, do nothing. + The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:`inquiry` type, or *NULL* if the object is immutable. -- 2.5.5