Skip to content

Add socket.close(fd) function #76635

Closed
Closed

Description

@tiran
BPO 32454
Nosy @pfmoore, @tiran, @tjguk, @zware, @zooba
PRs
  • bpo-32454: socket closefd #5048
  • 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 = None
    closed_at = <Date 2018-01-27.08:57:21.889>
    created_at = <Date 2017-12-30.09:37:23.786>
    labels = ['type-feature', '3.7']
    title = 'Add socket.close(fd) function'
    updated_at = <Date 2018-01-27.08:57:21.888>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2018-01-27.08:57:21.888>
    actor = 'christian.heimes'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-01-27.08:57:21.889>
    closer = 'christian.heimes'
    components = []
    creation = <Date 2017-12-30.09:37:23.786>
    creator = 'christian.heimes'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32454
    keywords = ['patch']
    message_count = 2.0
    messages = ['309224', '310850']
    nosy_count = 5.0
    nosy_names = ['paul.moore', 'christian.heimes', 'tim.golden', 'zach.ware', 'steve.dower']
    pr_nums = ['5048']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue32454'
    versions = ['Python 3.7']

    Activity

    1. tiran commented on Dec 30, 2017

      @tiran
      MemberAuthor

      os.close(fd) of a socket fd does not work some platforms, e.g. Windows. In the past we have used socket.socket(fileno=fd).close() to close a socket in a platform independent way. With bpo-28134 it may no longer work in all cases, most noticeable when the socket has neither been connected nor bound yet and auto-detection of type and family is used.

      Instead of adding more hacks, I propose to add a socket.close(fd) function as cross-platform way to close a socket fd. It won't be the first function that mimics an o' module function. The socket module already has the undocumented socket.dup(fd) function.

    2. added
      3.7 (EOL)
      type-feature
      on Dec 30, 2017
    3. tiran commented on Jan 27, 2018

      @tiran
      MemberAuthor

      New changeset d0e31b9 by Christian Heimes in branch 'master':
      bpo-32454: socket closefd (bpo-5048)
      d0e31b9

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)type-feature

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions