[issue26404] socketserver context manager

2016-04-12 Thread Martin Panter
Martin Panter added the comment: Thanks for the patch Aviv. I made a few minor English grammar etc tweaks in the version I committed, as pointed out in the review comments. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed _

[issue26404] socketserver context manager

2016-04-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5c4303c46a18 by Martin Panter in branch 'default': Issue #26404: Add context manager to socketserver, by Aviv Palivoda https://hg.python.org/cpython/rev/5c4303c46a18 -- nosy: +python-dev ___ Python tracke

[issue26404] socketserver context manager

2016-02-29 Thread Terry J. Reedy
Terry J. Reedy added the comment: I agree and consider this is an argument for adding the context manager methods and using them with 'with' in the examples. -- ___ Python tracker _

[issue26404] socketserver context manager

2016-02-29 Thread Martin Panter
Martin Panter added the comment: Server_close() was only documentated last year; see Issue 23254. For the examples that run until you interrupt them, the servers currently emit a resource warning (in addition to the KeyboardInterrupt traceback and the Python 2 bytes warnings): $ python -bWall

[issue26404] socketserver context manager

2016-02-29 Thread Aviv Palivoda
Aviv Palivoda added the comment: The examples did not close the server but I am not sure if that was a mistake. The server is not being closed only on examples where it is expected to run until there is a keyboard interrupt. However you can see that when you send keyboard interrupt to a server

[issue26404] socketserver context manager

2016-02-27 Thread Terry J. Reedy
Terry J. Reedy added the comment: This seems like an appropriate enhancement. I notice that the serve_forever examples did not previously have server_close(). Was this an oversight or will the server_close in __exit__ just be a no-op? -- nosy: +terry.reedy __

[issue26404] socketserver context manager

2016-02-25 Thread Aviv Palivoda
Aviv Palivoda added the comment: updated the patch according to the CR comments. -- Added file: http://bugs.python.org/file42030/socketserver_context_manager4.patch ___ Python tracker __

[issue26404] socketserver context manager

2016-02-24 Thread Aviv Palivoda
Aviv Palivoda added the comment: Updated the patch: 1. Did the changes requested in the CR. 2. Changed the example's in wsgiref.simple_server to use context manager. 3. Added What's New entry. -- Added file: http://bugs.python.org/file42016/socketserver_context_manager3.patch __

[issue26404] socketserver context manager

2016-02-23 Thread Martin Panter
Martin Panter added the comment: Thanks, the patch looks pretty good to me. I left some comments about minor things. Also, someone will need to write a What’s New entry. -- stage: -> patch review ___ Python tracker

[issue26404] socketserver context manager

2016-02-22 Thread Aviv Palivoda
Aviv Palivoda added the comment: Only closing the server :). 1. Did the changes requested in the CR. 2. Changed the example's in xmlrpc.server, http.server to use context manager. 3. Changed the xmlrpc.server, http.server server implementation when running python -m {xmlrpc.server, http.server}

[issue26404] socketserver context manager

2016-02-22 Thread Martin Panter
Martin Panter added the comment: I would support this change, as long as we aren’t supporting using server_close() to stop the server loop at the same time. It might be worth updating other example code that uses server_close(), in particular in the xmlrpc.server documentation. -- __

[issue26404] socketserver context manager

2016-02-21 Thread Aviv Palivoda
New submission from Aviv Palivoda: As Martin commented on my patch at issue 26392 the socketserver.server_close is like the file close. That made me think that we should add a context manager to the socketserver. -- components: Library (Lib) files: socketserver_context_manager.patch ke