Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(13)

Unified Diff: Doc/library/http.server.rst

Issue 26404: socketserver context manager
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Doc/library/socketserver.rst » ('j') | Doc/library/socketserver.rst » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Doc/library/http.server.rst Wed Feb 24 06:14:15 2016 +0000
+++ b/Doc/library/http.server.rst Thu Feb 25 19:24:21 2016 +0200
@@ -375,10 +375,9 @@
Handler = http.server.SimpleHTTPRequestHandler
- httpd = socketserver.TCPServer(("", PORT), Handler)
-
- print("serving at port", PORT)
- httpd.serve_forever()
+ with socketserver.TCPServer(("", PORT), Handler) as httpd:
+ print("serving at port", PORT)
+ httpd.serve_forever()
.. _http-server-cli:
« no previous file with comments | « no previous file | Doc/library/socketserver.rst » ('j') | Doc/library/socketserver.rst » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+