Skip to content

Commit 1465769

Browse files
committed
Document PyObject_ClearWeakRefs
1 parent b97f25b commit 1465769

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Doc/c-api/weakref.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,13 @@ as much as it can.
6767
.. c:function:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref)
6868
6969
Similar to :c:func:`PyWeakref_GetObject`, but does no error checking.
70+
71+
72+
.. c:function:: void PyObject_ClearWeakRefs(PyObject *object)
73+
74+
This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler
75+
to clear weak references.
76+
77+
This iterates through the weak references for *object* and calls callbacks
78+
for those references which have one. It returns when all callbacks have
79+
been attempted.

Doc/whatsnew/3.12.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ Porting to Python 3.12
960960
Classes declaring :const:`Py_TPFLAGS_MANAGED_DICT` should call
961961
:c:func:`!_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict`
962962
to traverse and clear their instance's dictionaries.
963-
To clear weakrefs, call :c:func:`!PyObject_ClearWeakRefs`, as before.
963+
To clear weakrefs, call :c:func:`PyObject_ClearWeakRefs`, as before.
964964

965965
* The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like
966966
paths, like :class:`bytearray` and :class:`memoryview` types: only the exact

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy