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: Add socket.close(fd) function
Type: enhancement Stage: resolved
Components: Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2017-12-30 09:37 by christian.heimes, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5048 merged christian.heimes, 2017-12-30 09:42
Messages (2)
msg309224 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-12-30 09:37
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 #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.
msg310850 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2018-01-27 08:54
New changeset d0e31b980f18101738d0ec518cb991a5fb73fe93 by Christian Heimes in branch 'master':
bpo-32454: socket closefd (#5048)
Date User Action Args
2022-04-11 14:58:56adminsetgithub: 76635
2018-01-27 08:57:21christian.heimessetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-01-27 08:54:15christian.heimessetmessages: + msg310850
2017-12-30 11:56:20pitrousetnosy: + paul.moore, tim.golden, zach.ware, steve.dower
2017-12-30 09:42:06christian.heimessetkeywords: + patch
stage: patch review
pull_requests: + pull_request4930
2017-12-30 09:37:23christian.heimescreate