summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/weakref.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/c-api/weakref.rst')
-rw-r--r--Doc/c-api/weakref.rst9
1 files changed, 8 insertions, 1 deletions
diff --git a/Doc/c-api/weakref.rst b/Doc/c-api/weakref.rst
index 80ebf82..226ec38 100644
--- a/Doc/c-api/weakref.rst
+++ b/Doc/c-api/weakref.rst
@@ -63,10 +63,17 @@ as much as it can.
.. cfunction:: PyObject* PyWeakref_GetObject(PyObject *ref)
Return the referenced object from a weak reference, *ref*. If the referent is
- no longer live, returns ``None``.
+ no longer live, returns :const:`Py_None`.
.. versionadded:: 2.2
+ .. warning::
+
+ This function returns a **borrowed reference** to the referenced object.
+ This means that you should always call :cfunc:`Py_INCREF` on the object
+ except if you know that it cannot be destroyed while you are still
+ using it.
+
.. cfunction:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref)