[New-bugs-announce] [issue32454] Add socket.close(fd) function

Christian Heimes report at bugs.python.org
Sat Dec 30 04:37:23 EST 2017

New submission from Christian Heimes <lists at cheimes.de>:

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.

messages: 309224
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Add socket.close(fd) function
type: enhancement
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list