diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst index b9e887cab5d..7f3d267d74c 100644 --- a/Doc/library/weakref.rst +++ b/Doc/library/weakref.rst @@ -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 - - >>> del obj - obj dead or exiting +.. doctest:: + :options: +SKIP + + >>> obj = Object() + >>> weakref.finalize(obj, print, "obj dead or exiting") + + >>> exit() + obj dead or exiting Comparing finalizers with :meth:`__del__` methods