Skip to content
Merged
Changes from all 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
13 changes: 8 additions & 5 deletions Doc/library/weakref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,14 @@ Unless you set the :attr:`~finalize.atexit` attribute to
:const:`False`, a finalizer will be called when the program exits if it
is still alive. For instance

>>> obj = Object()
>>> weakref.finalize(obj, print, "obj dead or exiting") #doctest:+ELLIPSIS
<finalize object at ...; for 'Object' at ...>
>>> del obj
obj dead or exiting
.. doctest::
:options: +SKIP

>>> obj = Object()
>>> weakref.finalize(obj, print, "obj dead or exiting")
<finalize object at ...; for 'Object' at ...>
>>> exit()
obj dead or exiting


Comparing finalizers with :meth:`__del__` methods
Expand Down