diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-10-11 14:30:21 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-10-11 14:30:21 (GMT) |
commit | 1867e3ef9e3c41bad6ed3b6cf2dac042ab455b3f (patch) | |
tree | 2a08c7ce8fd621cb95b7055f15e01a79eac0ca7d /Doc/library | |
parent | a75e887259681cba1c13fd661817110e6132c037 (diff) | |
parent | ccd8e34508c29f0a87fd41a5b0f1145ae405966e (diff) | |
download | cpython-1867e3ef9e3c41bad6ed3b6cf2dac042ab455b3f.zip cpython-1867e3ef9e3c41bad6ed3b6cf2dac042ab455b3f.tar.gz cpython-1867e3ef9e3c41bad6ed3b6cf2dac042ab455b3f.tar.bz2 |
Merge 3.4 (asyncio doc)
Diffstat (limited to 'Doc/library')
-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) |