]> granicus.if.org Git - python/commitdiff
bpo-36597: fix weakref example code (GH-12779)
authorInada Naoki <songofacandy@gmail.com>
Thu, 11 Apr 2019 10:05:32 +0000 (19:05 +0900)
committerGitHub <noreply@github.com>
Thu, 11 Apr 2019 10:05:32 +0000 (19:05 +0900)
Commit 57b1a2862 fixed doctest, but example code is not
match with document.
Just skip doctest for the block.

Doc/library/weakref.rst

index b9e887cab5d15858c8fad8dbf08da50f258b368b..7f3d267d74c2ec588702db7610d17441d3efc107 100644 (file)
@@ -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