From ffafa4d64fa022fc6eec7d1b3ce2244174991b91 Mon Sep 17 00:00:00 2001 From: Christophe Haen Date: Mon, 24 Jun 2024 11:08:18 +0200 Subject: [PATCH 1/2] gh-120937: Reference weakref from the __del__ documentation The weakref documentation refers to __del__, but not the other way around. --- Doc/reference/datamodel.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index af4c585e1c3e2f..b23c4a04a6cd21 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 straight forward way to register + a cleanup function to be called when an object is garbage collected. .. note:: From cb13db9db852329202459072d984820599144b93 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:25:43 +0300 Subject: [PATCH 2/2] Update Doc/reference/datamodel.rst --- Doc/reference/datamodel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index b23c4a04a6cd21..34d8bbee4c6806 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1667,7 +1667,7 @@ 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 straight forward way to register + :class:`weakref.finalize` provides a straightforward way to register a cleanup function to be called when an object is garbage collected. .. note::