diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-11-19 12:31:46 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-11-19 12:31:46 +0100 |
commit | af3fb230e0e2f79b0e85260eb2f802ae9762ad36 (patch) | |
tree | bc059421bd804ed2656b0cc4ecc25bc38157822a | |
parent | 024abe90120796f003e5d1817274f6f12c8d6ccd (diff) | |
download | aioeventlet-af3fb230e0e2f79b0e85260eb2f802ae9762ad36.tar.gz |
Fix socketpair on Windows
-rw-r--r-- | aiogreen.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/aiogreen.py b/aiogreen.py index d32a568..78f936c 100644 --- a/aiogreen.py +++ b/aiogreen.py @@ -1,8 +1,13 @@ +import sys try: import asyncio from asyncio import selector_events from asyncio import selectors from asyncio.base_events import BaseEventLoop + if sys.platform == 'win32': + from asyncio.windows_utils import socketpair + else: + from socket import socketpair _FUTURE_CLASSES = (asyncio.Future,) except ImportError: @@ -17,6 +22,10 @@ except ImportError: else: # Trollius 1.0.1 and newer _FUTURE_CLASSES = asyncio.futures._FUTURE_CLASSES + if sys.platform == 'win32': + from trollius.windows_utils import socketpair + else: + from socket import socketpair import errno import eventlet.greenio import eventlet.semaphore @@ -91,7 +100,7 @@ class _ThreadQueue: def start(self): assert self._ssock is None - self._ssock, self._csock = socket.socketpair() + self._ssock, self._csock = socketpair() self._ssock.setblocking(False) self._csock.setblocking(False) self._loop.add_reader(self._ssock.fileno(), self._consume) |