[Python-checkins] bpo-36597: fix weakref example code (GH-12779)

Inada Naoki webhook-mailer at python.org
Thu Apr 11 06:05:40 EDT 2019


https://github.com/python/cpython/commit/b3c92c6ae923ffb2b9ac5f80b28ecd689de48662
commit: b3c92c6ae923ffb2b9ac5f80b28ecd689de48662
branch: master
author: Inada Naoki <songofacandy at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-04-11T19:05:32+09:00
summary:

bpo-36597: fix weakref example code (GH-12779)

Commit 57b1a2862 fixed doctest, but example code is not
match with document.
Just skip doctest for the block.

files:
M Doc/library/weakref.rst

diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst
index b9e887cab5d1..7f3d267d74c2 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
-    <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



More information about the Python-checkins mailing list