[issue27377] Add smarter socket.fromfd()

Neil Schemenauer report at bugs.python.org
Thu Jul 14 13:19:36 EDT 2016


Neil Schemenauer added the comment:

I just tested on Windows.  fdtype() fails with:
OSError: [WinError 10022] An invalid argument was supplied

The getsockname() call fails with WSAGetLastError() == 10022.  getsockname() is used to find the address family.  Perhaps there is some other way to get it on Windows.

The easiest fix would be to #ifdef MS_WINDOWS out the whole socket_fdtype() function.  Passing file descriptors around is not a thing on Windows anyhow.

There is still the issue of unexpected errors getting returned inside fdtype() (e.g. as suggested by Martin).  One idea is to commit the code as is and fix errors as they appear.

----------

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


More information about the Python-bugs-list mailing list