[Python-checkins] cpython (merge 3.4 -> default): Merge 3.4 (asyncio doc)
victor.stinner
python-checkins at python.org
Sat Oct 11 16:30:30 CEST 2014
https://hg.python.org/cpython/rev/408bbdaef8d4
changeset: 92962:408bbdaef8d4
parent: 92960:24a1ca785fc3
parent: 92961:a33b3bef2a1c
user: Victor Stinner <victor.stinner at gmail.com>
date: Sat Oct 11 16:30:21 2014 +0200
summary:
Merge 3.4 (asyncio doc)
files:
Doc/library/asyncio-eventloop.rst | 7 +++++--
Doc/library/asyncio-protocol.rst | 7 +++++--
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
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -676,10 +676,13 @@
: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
--- a/Doc/library/asyncio-protocol.rst
+++ b/Doc/library/asyncio-protocol.rst
@@ -521,10 +521,13 @@
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
--- a/Doc/library/asyncio-stream.rst
+++ b/Doc/library/asyncio-stream.rst
@@ -296,11 +296,14 @@
: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)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list