From: chaen Date: Wed, 26 Jun 2024 20:07:09 +0000 (+0200) Subject: gh-120937: Reference weakref from the `__del__` documentation (#120940) X-Git-Tag: v3.14.0a1~1314 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1c13b29d54ad6d7c9e030227d575ad7d21b4054f;p=thirdparty%2FPython%2Fcpython.git gh-120937: Reference weakref from the `__del__` documentation (#120940) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index af4c585e1c3e..34d8bbee4c68 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1667,6 +1667,8 @@ Basic customization It is not guaranteed that :meth:`__del__` methods are called for objects that still exist when the interpreter exits. + :class:`weakref.finalize` provides a straightforward way to register + a cleanup function to be called when an object is garbage collected. .. note::