[issue24911] Context manager of socket.socket is not documented

2016-04-23 Thread Martin Panter
Changes by Martin Panter : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue24911] Context manager of socket.socket is not documented

2016-04-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset d5f7980dd654 by Martin Panter in branch '3.5': Issue #24911: All socket objects are context managers; update examples https://hg.python.org/cpython/rev/d5f7980dd654 New changeset 711201953505 by Martin Panter in branch 'default': Issue #24911: Merge

[issue24911] Context manager of socket.socket is not documented

2016-04-03 Thread Martin Panter
Martin Panter added the comment: FWIW I discovered that socket.close() or __exit__() does not actually raise exceptions for cases like EBADF, see Issue 26685. -- ___ Python tracker

[issue24911] Context manager of socket.socket is not documented

2016-02-17 Thread Martin Panter
Martin Panter added the comment: Thanks for the reviews. In this new patch, I modified two existing examples, but did not add any new example. Does that work for you Yury? Also modified example code for the socketserver module. Victor: IMO the “with conn” in the example is not overkill. It en

[issue24911] Context manager of socket.socket is not documented

2016-02-17 Thread STINNER Victor
STINNER Victor added the comment: I reviewed the patch. > It would also be cool if you can add a short code snippet somewhere: The socket module has examples. Why not modifying these examples to promote the context manager protocol? Example: s = socket.socket(socket.AF_INET, socket.S

[issue24911] Context manager of socket.socket is not documented

2016-02-16 Thread Yury Selivanov
Yury Selivanov added the comment: The patch looks good. It would also be cool if you can add a short code snippet somewhere: sock = socket.socket() with sock: sock.bind(('127.0.0.1', 8080)) sock.listen() ... -- nosy: +yselivanov ___

[issue24911] Context manager of socket.socket is not documented

2016-02-16 Thread Berker Peksag
Berker Peksag added the comment: socket-context.patch looks good to me. There is no need to add a NEWS entry for this. -- nosy: +berker.peksag stage: patch review -> commit review versions: -Python 3.4 ___ Python tracker

[issue24911] Context manager of socket.socket is not documented

2015-08-30 Thread Martin Panter
Martin Panter added the comment: Here is my proposed patch -- keywords: +patch stage: needs patch -> patch review Added file: http://bugs.python.org/file40307/socket-context.patch ___ Python tracker ___

[issue24911] Context manager of socket.socket is not documented

2015-08-25 Thread Martin Panter
Martin Panter added the comment: IMO the change notice for create_connection() should be moved to apply to the “socket” class, perhaps the “Socket Objects” section. Issue 9794 looks like context manager support was added specifically for create_connection(), however any socket object, no matte

[issue24911] Context manager of socket.socket is not documented

2015-08-24 Thread Berker Peksag
Changes by Berker Peksag : -- keywords: +easy stage: -> needs patch type: -> enhancement versions: +Python 3.5, Python 3.6 ___ Python tracker ___ __

[issue24911] Context manager of socket.socket is not documented

2015-08-21 Thread zodalahtathi
New submission from zodalahtathi: socket.socket has a context manager to automatically close the socket with the `with` statement: https://hg.python.org/cpython/file/d1bf181afa82/Lib/socket.py#l138 However it is not documented, unlike socket.create_connection. -- assignee: docs@python