Here's a new version along the lines I described. Please test on
Windows. It works on Linux and OSX. What this includes:
- the dup-on-windows implementation by R Oudkerk, with the
GetLastError() suggestion from Thomas Heller.
- Replace the C implementations of dup() and accept() with _dup() and
_accept() that return file descriptors instead of socket objects.
- Implement accept() and dup() in Python using _accept() and _dup().
- Get rid of socket.fromfd(). You can use socket.socket(..., fileno=...)
instead (it doesn't dup though).