[issue16802] fileno argument to socket.socket() undocumented

Serhiy Storchaka report at bugs.python.org
Mon Dec 31 15:11:18 CET 2012


Serhiy Storchaka added the comment:

> It has at least one potential use.  On Windows socket.detach() returns a
> socket handle but there is no documented way to close it -- os.close()
> will not work.  The only way to close it that I can see (without resorting
> to ctypes) is with something like
> 
>     socket.socket(fileno=handle).close()

There is an alternative (documented) interface:

    socket.fromfd(handle, socket.AF_INET, socket.SOCK_STREAM).close()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16802>
_______________________________________


More information about the Python-bugs-list mailing list