From a10dc3efcbba8aa7cc7d1a017f8b22fc4fa8e87c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 28 Nov 2017 11:15:26 +0100 Subject: asyncio: use directly socket.socketpair() (#4597) Since Python 3.5, socket.socketpair() is also available on Windows, and so can be used directly, rather than using asyncio.windows_utils.socketpair(). --- Lib/asyncio/unix_events.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Lib/asyncio/unix_events.py') diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index be98f334ce..94157f8c80 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -55,9 +55,6 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): super().__init__(selector) self._signal_handlers = {} - def _socketpair(self): - return socket.socketpair() - def close(self): super().close() for sig in list(self._signal_handlers): @@ -677,7 +674,7 @@ class _UnixSubprocessTransport(base_subprocess.BaseSubprocessTransport): # socket (which we use in order to detect closing of the # other end). Notably this is needed on AIX, and works # just fine on other platforms. - stdin, stdin_w = self._loop._socketpair() + stdin, stdin_w = socket.socketpair() # Mark the write end of the stdin pipe as non-inheritable, # needed by close_fds=False on Python 3.3 and older -- cgit v1.2.1