Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.create_connection context manager #54003

Closed
giampaolo opened this issue Sep 7, 2010 · 5 comments
Closed

socket.create_connection context manager #54003

giampaolo opened this issue Sep 7, 2010 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@giampaolo
Copy link
Contributor

BPO 9794
Nosy @amauryfa, @pitrou, @giampaolo
Files
  • socket_ctx_mgr.patch
  • socket_ctx_mgr.patch
  • socket_ctx_mgr.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/giampaolo'
    closed_at = <Date 2010-09-08.22:44:48.654>
    created_at = <Date 2010-09-07.22:23:47.438>
    labels = ['library']
    title = 'socket.create_connection context manager'
    updated_at = <Date 2010-09-08.22:44:48.653>
    user = 'https://github.com/giampaolo'

    bugs.python.org fields:

    activity = <Date 2010-09-08.22:44:48.653>
    actor = 'giampaolo.rodola'
    assignee = 'giampaolo.rodola'
    closed = True
    closed_date = <Date 2010-09-08.22:44:48.654>
    closer = 'giampaolo.rodola'
    components = ['Library (Lib)']
    creation = <Date 2010-09-07.22:23:47.438>
    creator = 'giampaolo.rodola'
    dependencies = []
    files = ['18789', '18790', '18804']
    hgrepos = []
    issue_num = 9794
    keywords = ['patch']
    message_count = 5.0
    messages = ['115812', '115814', '115817', '115911', '115912']
    nosy_count = 3.0
    nosy_names = ['amaury.forgeotdarc', 'pitrou', 'giampaolo.rodola']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue9794'
    versions = ['Python 3.2']

    @giampaolo
    Copy link
    Contributor Author

    Patch in attachment adds a context manager to socket.socket class so that socket.create_connection() can be used with "with" statement.

    @giampaolo giampaolo added the stdlib Python modules in the Lib dir label Sep 7, 2010
    @pitrou
    Copy link
    Member

    pitrou commented Sep 7, 2010

    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.

    @giampaolo
    Copy link
    Contributor Author

    It wasn't easy but here it is. =)
    I'll submit a patch which updates the doc tomorrow.

    @giampaolo giampaolo self-assigned this Sep 7, 2010
    @giampaolo
    Copy link
    Contributor Author

    Patch which updates doc is in attachment.

    @giampaolo
    Copy link
    Contributor Author

    Committed in r84639.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants