From: Martin Panter Date: Fri, 29 Jul 2016 01:49:37 +0000 (+0000) Subject: Issue #26462: Merge code block fixes from 3.5 X-Git-Tag: v3.6.0a4~99 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a09315ff098224da138ff708e470ebc1c0ba8ac;p=thirdparty%2FPython%2Fcpython.git Issue #26462: Merge code block fixes from 3.5 --- 6a09315ff098224da138ff708e470ebc1c0ba8ac diff --cc Doc/library/socketserver.rst index 3eb27e3a14a0,087f4e0d4525..218a31c848aa --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@@ -601,25 -585,27 +605,27 @@@ An example for the :class:`ThreadingMix HOST, PORT = "localhost", 0 server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) - ip, port = server.server_address + with server: + ip, port = server.server_address - # Start a thread with the server -- that thread will then start one - # more thread for each request - server_thread = threading.Thread(target=server.serve_forever) - # Exit the server thread when the main thread terminates - server_thread.daemon = True - server_thread.start() - print("Server loop running in thread:", server_thread.name) + # Start a thread with the server -- that thread will then start one + # more thread for each request + server_thread = threading.Thread(target=server.serve_forever) + # Exit the server thread when the main thread terminates + server_thread.daemon = True + server_thread.start() + print("Server loop running in thread:", server_thread.name) - client(ip, port, "Hello World 1") - client(ip, port, "Hello World 2") - client(ip, port, "Hello World 3") + client(ip, port, "Hello World 1") + client(ip, port, "Hello World 2") + client(ip, port, "Hello World 3") - server.shutdown() - server.server_close() + server.shutdown() - The output of the example should look something like this:: + The output of the example should look something like this: + + .. code-block:: shell-session $ python ThreadedTCPServer.py Server loop running in thread: Thread-1 diff --cc Doc/tutorial/interpreter.rst index c89fae36cb76,e8d8e2b56aaf..faf57a344c02 --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@@ -94,10 -94,12 +94,12 @@@ mode*. In this mode it prompts for th usually three greater-than signs (``>>>``); for continuation lines it prompts with the *secondary prompt*, by default three dots (``...``). The interpreter prints a welcome message stating its version number and a copyright notice - before printing the first prompt:: + before printing the first prompt: + + .. code-block:: shell-session - $ python3.5 - Python 3.5 (default, Sep 16 2015, 09:25:04) + $ python3.6 + Python 3.6 (default, Sep 16 2015, 09:25:04) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>>