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

Unified Diff: Lib/socketserver.py

Issue 26404: socketserver context manager
Patch Set: Created 3 years, 12 months 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
--- a/Lib/socketserver.py Wed Feb 24 06:14:15 2016 +0000
+++ b/Lib/socketserver.py Thu Feb 25 19:24:21 2016 +0200
@@ -378,6 +378,12 @@
traceback.print_exc()
print('-'*40, file=sys.stderr)
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.server_close()
+
class TCPServer(BaseServer):
« Doc/whatsnew/3.6.rst ('K') | « Lib/http/server.py ('k') | Lib/test/test_socketserver.py » ('j') | no next file with comments »

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