mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
#8578: mention danger of not incref'ing weak referenced object.
This commit is contained in:
parent
2d3c4e79a1
commit
502c3eb52f
1 changed files with 8 additions and 1 deletions
|
@ -53,7 +53,14 @@ 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`.
|
||||
|
||||
.. 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue