diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-10-11 14:30:02 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-10-11 14:30:02 (GMT) |
commit | ccd8e34508c29f0a87fd41a5b0f1145ae405966e (patch) | |
tree | 2b5621ae971bcbb7e25ab0cee199825c41a60940 /Doc | |
parent | 04e6df330ddbec28cbbcba0f36235040e267692d (diff) | |
download | cpython-ccd8e34508c29f0a87fd41a5b0f1145ae405966e.zip cpython-ccd8e34508c29f0a87fd41a5b0f1145ae405966e.tar.gz cpython-ccd8e34508c29f0a87fd41a5b0f1145ae405966e.tar.bz2 |
asyncio doc: socket.socketpair() is not available on Windows yet
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-eventloop.rst | 7 | ||||
-rw-r--r-- | Doc/library/asyncio-protocol.rst | 7 | ||||
-rw-r--r-- | Doc/library/asyncio-stream.rst | 7 |
3 files changed, 15 insertions, 6 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 59682d3..0d9b8f4 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -676,10 +676,13 @@ Wait until a file descriptor received some data using the :meth:`BaseEventLoop.add_reader` method and then close the event loop:: import asyncio - import socket + try: + from socket import socketpair + except ImportError: + from asyncio.windows_utils import socketpair # Create a pair of connected file descriptors - rsock, wsock = socket.socketpair() + rsock, wsock = socketpair() loop = asyncio.get_event_loop() def reader(): diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst index 3fa2f3e..52da1b4 100644 --- a/Doc/library/asyncio-protocol.rst +++ b/Doc/library/asyncio-protocol.rst @@ -521,10 +521,13 @@ Wait until a socket receives data using the the event loop :: import asyncio - import socket + try: + from socket import socketpair + except ImportError: + from asyncio.windows_utils import socketpair # Create a pair of connected sockets - rsock, wsock = socket.socketpair() + rsock, wsock = socketpair() loop = asyncio.get_event_loop() class MyProtocol(asyncio.Protocol): diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst index 9db2380..c3bbd20 100644 --- a/Doc/library/asyncio-stream.rst +++ b/Doc/library/asyncio-stream.rst @@ -296,11 +296,14 @@ Coroutine waiting until a socket receives data using the :func:`open_connection` function:: import asyncio - import socket + try: + from socket import socketpair + except ImportError: + from asyncio.windows_utils import socketpair def wait_for_data(loop): # Create a pair of connected sockets - rsock, wsock = socket.socketpair() + rsock, wsock = socketpair() # Register the open socket to wait for data reader, writer = yield from asyncio.open_connection(sock=rsock, loop=loop) |