mirror of https://github.com/python/cpython
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
This commit is contained in:
parent
489d91c61d
commit
4cab2cd0c0
|
@ -2297,6 +2297,10 @@ def _start_server(urlhandler, port):
|
||||||
def stop(self):
|
def stop(self):
|
||||||
"""Stop the server and this thread nicely"""
|
"""Stop the server and this thread nicely"""
|
||||||
self.docserver.quit = True
|
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.serving = False
|
||||||
self.url = None
|
self.url = None
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
pydoc: the stop() method of the private ServerThread class now waits until
|
||||||
|
DocServer.serve_until_quit() completes and then explicitly sets its
|
||||||
|
docserver attribute to None to break a reference cycle.
|
Loading…
Reference in New Issue