Issue 9794: socket.create_connection context manager (original) (raw)

Created on 2010-09-07 22:23 by giampaolo.rodola, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
socket_ctx_mgr.patch giampaolo.rodola,2010-09-07 22:23
socket_ctx_mgr.patch giampaolo.rodola,2010-09-07 23:06
socket_ctx_mgr.patch giampaolo.rodola,2010-09-08 22:35
Messages (5)
msg115812 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-09-07 22:23
Patch in attachment adds a context manager to socket.socket class so that socket.create_connection() can be used with "with" statement.
msg115814 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-09-07 22:30
You don't need to use socketserver. Take a look at how the other tests in test_socket are written. Inheriting from ThreadedTCPSocketTest should be easy.
msg115817 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-09-07 23:06
It wasn't easy but here it is. =) I'll submit a patch which updates the doc tomorrow.
msg115911 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-09-08 22:35
Patch which updates doc is in attachment.
msg115912 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-09-08 22:44
Committed in r84639.
History
Date User Action Args
2022-04-11 14:57:06 admin set github: 54003
2010-09-08 22:44:48 giampaolo.rodola set status: open -> closedresolution: fixedmessages: +
2010-09-08 22:35:22 giampaolo.rodola set files: + socket_ctx_mgr.patchmessages: +
2010-09-07 23:07:52 giampaolo.rodola set assignee: giampaolo.rodola
2010-09-07 23:06:47 giampaolo.rodola set files: + socket_ctx_mgr.patchmessages: +
2010-09-07 22:30:52 pitrou set messages: +
2010-09-07 22:23:47 giampaolo.rodola create