Skip to content

Commit bc7c48c

Browse files
chaenhugovk
authored andcommitted
pythongh-120937: Reference weakref from the __del__ documentation (pythonGH-120940)
(cherry picked from commit 1c13b29) Co-authored-by: chaen <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 4868d1b commit bc7c48c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Doc/reference/datamodel.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,8 @@ Basic customization
16431643

16441644
It is not guaranteed that :meth:`__del__` methods are called for objects
16451645
that still exist when the interpreter exits.
1646+
:class:`weakref.finalize` provides a straightforward way to register
1647+
a cleanup function to be called when an object is garbage collected.
16461648

16471649
.. note::
16481650

0 commit comments

Comments
 (0)