summaryrefslogtreecommitdiff
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-08-21 23:24:40 +0200
committerGitHub <noreply@github.com>2017-08-21 23:24:40 +0200
commit4cab2cd0c05fcda5fcb128c9eb230253fff88c21 (patch)
tree20e12a6ededb945e909ea65dcda3d995933bbd74 /Lib/pydoc.py
parent489d91c61d02f401551966f1558ee2dc87fc0ad9 (diff)
downloadcpython-git-4cab2cd0c05fcda5fcb128c9eb230253fff88c21.tar.gz
bpo-31238: pydoc ServerThread.stop() now joins itself (#3151)
* bpo-31238: pydoc ServerThread.stop() now joins itself ServerThread.stop() now joins itself to wait until DocServer.serve_until_quit() completes and then explicitly sets its docserver attribute to None to break a reference cycle. * Add NEWS.d entry
Diffstat (limited to 'Lib/pydoc.py')
-rw-r--r--Lib/pydoc.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 376c4459fe..5edc77005a 100644
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -2297,6 +2297,10 @@ def _start_server(urlhandler, port):
def stop(self):
"""Stop the server and this thread nicely"""
self.docserver.quit = True
+ self.join()
+ # explicitly break a reference cycle: DocServer.callback
+ # has indirectly a reference to ServerThread.
+ self.docserver = None
self.serving = False
self.url = None