#8578: mention danger of not incref'ing weak referenced object.
This commit is contained in:
parent
2d3c4e79a1
commit
502c3eb52f
@ -53,7 +53,14 @@ as much as it can.
|
|||||||
.. cfunction:: PyObject* PyWeakref_GetObject(PyObject *ref)
|
.. cfunction:: PyObject* PyWeakref_GetObject(PyObject *ref)
|
||||||
|
|
||||||
Return the referenced object from a weak reference, *ref*. If the referent is
|
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`.
|
||||||
|
|
||||||
|
.. 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)
|
.. cfunction:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user