Remove unused py27 socketpair/makefile workaround

Python2.7 has a bug that means the sockets returned from socketpair()
are not wrapped in the usual socket.socket class, and contain a broken
makefile() method.

This was important a long time ago when privsep used file
operations (and sock.makefile()) for communication.  Privsep now uses
socket operations directly, and never calls makefile() on the
communication socket.

Further, the workaround breaks on py34 where the socket classes are
completely different (and don't have the original issue).  Well past
time for the workaround to be removed and forgotten.

Change-Id: Id6395b8497b9f5449893e17d07fc4b664ee041ce
This commit is contained in:
Angus Lees 2016-04-21 16:18:56 +10:00
parent 54e2d2f7f5
commit 79ab8a755c
1 changed files with 0 additions and 8 deletions

View File

@ -227,14 +227,6 @@ class ForkingClientChannel(_ClientChannel):
sock_a, sock_b = socket.socketpair()
# Python bug workaround. It seems socketpair sockets aren't
# wrapped in the same way as socket.socket return values are. The
# unwrapped socket object in py27 contains a broken .makefile
# implementation (tries to seek).
if not isinstance(sock_a, socket.SocketType):
sock_a = socket.SocketType(_sock=sock_a)
sock_b = socket.SocketType(_sock=sock_b)
for s in (sock_a, sock_b):
s.setblocking(True)
# Important that these sockets don't get leaked