Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Doc/c-api/type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ Type Objects

.. versionadded:: 3.12

.. c:function:: int PyType_SUPPORTS_WEAKREFS(PyTypeObject *type)

Return true if instances of *type* supports creating weak references, false
otherwise. This function always succeeds. *type* must not be ``NULL``.

.. seealso::
* :ref:`weakrefobjects`
* :py:mod:`weakref`

Creating Heap-Allocated Types
.............................
Expand Down
8 changes: 8 additions & 0 deletions Doc/c-api/weakref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ as much as it can.
weakly referenceable object, or if *callback* is not callable, ``None``, or
``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.

.. seealso::
:c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly
referenceable.


.. c:function:: PyObject* PyWeakref_NewProxy(PyObject *ob, PyObject *callback)

Expand All @@ -57,6 +61,10 @@ as much as it can.
is not a weakly referenceable object, or if *callback* is not callable,
``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.

.. seealso::
:c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly
referenceable.


.. c:function:: int PyWeakref_GetRef(PyObject *ref, PyObject **pobj)

Expand Down
Loading