diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-08-01 19:12:45 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-08-01 19:12:45 (GMT) |
commit | 39668f57f445b8a2db63b0d0dc32c55a90d3f59e (patch) | |
tree | d7e9d1e0d5a45955ab883d8fbc5a020cec21df38 /Doc/c-api/exceptions.rst | |
parent | b3c872403d0d2b00a1a383190d3e14eb94e84df1 (diff) | |
download | cpython-39668f57f445b8a2db63b0d0dc32c55a90d3f59e.zip cpython-39668f57f445b8a2db63b0d0dc32c55a90d3f59e.tar.gz cpython-39668f57f445b8a2db63b0d0dc32c55a90d3f59e.tar.bz2 |
Issue #18589: fix hyperlinking of type slots (tp_*)
Diffstat (limited to 'Doc/c-api/exceptions.rst')
-rw-r--r-- | Doc/c-api/exceptions.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index c0c30a0..c3d978f 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -607,28 +607,28 @@ recursion depth automatically). Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each *successful* invocation of :c:func:`Py_EnterRecursiveCall`. -Properly implementing :attr:`tp_repr` for container types requires +Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types requires special recursion handling. In addition to protecting the stack, -:attr:`tp_repr` also needs to track objects to prevent cycles. The +:c:member:`~PyTypeObject.tp_repr` also needs to track objects to prevent cycles. The following two functions facilitate this functionality. Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`. .. c:function:: int Py_ReprEnter(PyObject *object) - Called at the beginning of the :attr:`tp_repr` implementation to + Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` implementation to detect cycles. If the object has already been processed, the function returns a - positive integer. In that case the :attr:`tp_repr` implementation + positive integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation should return a string object indicating a cycle. As examples, :class:`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``. The function will return a negative integer if the recursion limit - is reached. In that case the :attr:`tp_repr` implementation should + is reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation should typically return ``NULL``. - Otherwise, the function returns zero and the :attr:`tp_repr` + Otherwise, the function returns zero and the :c:member:`~PyTypeObject.tp_repr` implementation can continue normally. .. c:function:: void Py_ReprLeave(PyObject *object) |