This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: socket.create_connection context manager
Type: Stage:
Components: Library (Lib) Versions: Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: giampaolo.rodola Nosy List: amaury.forgeotdarc, giampaolo.rodola, pitrou
Priority: normal Keywords: patch

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

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.
Date User Action Args
2022-04-11 14:57:06adminsetgithub: 54003
2010-09-08 22:44:48giampaolo.rodolasetstatus: open -> closed
resolution: fixed
messages: + msg115912
2010-09-08 22:35:22giampaolo.rodolasetfiles: + socket_ctx_mgr.patch

messages: + msg115911
2010-09-07 23:07:52giampaolo.rodolasetassignee: giampaolo.rodola
2010-09-07 23:06:47giampaolo.rodolasetfiles: + socket_ctx_mgr.patch

messages: + msg115817
2010-09-07 22:30:52pitrousetmessages: + msg115814
2010-09-07 22:23:47giampaolo.rodolacreate