Index: Lib/socket.py =================================================================== --- Lib/socket.py (revision 59313) +++ Lib/socket.py (working copy) @@ -213,6 +213,27 @@ socket = SocketType = _socketobject + +try: + _real_fromfd = fromfd +except NameError: + pass +else: + def fromfd(*args): + return _socketobject(_sock=_real_fromfd(*args)) + fromfd.__doc__ = _real_fromfd.__doc__ + +try: + _real_socketpair = socketpair +except NameError: + pass +else: + def socketpair(*args): + a, b = _real_socketpair(*args) + return _socketobject(_sock=a), _socketobject(_sock=b) + socketpair.__doc__ = _real_socketpair.__doc__ + + class _fileobject(object): """Faux file object attached to a socket object."""