[Python-checkins] cpython (3.4): Issue #21006: Fix subprocess example on Windows in asyncio doc
victor.stinner
python-checkins at python.org
Fri Mar 21 17:16:23 CET 2014
http://hg.python.org/cpython/rev/ab0aa412fca2
changeset: 89906:ab0aa412fca2
branch: 3.4
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Mar 21 11:56:40 2014 +0100
summary:
Issue #21006: Fix subprocess example on Windows in asyncio doc
files:
Doc/library/asyncio-subprocess.rst | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst
--- a/Doc/library/asyncio-subprocess.rst
+++ b/Doc/library/asyncio-subprocess.rst
@@ -146,6 +146,7 @@
display the output::
import asyncio
+ import os
import sys
from asyncio import subprocess
@@ -164,7 +165,11 @@
exitcode = yield from proc.wait()
return (exitcode, stdout)
- loop = asyncio.get_event_loop()
+ if os.name == 'nt':
+ loop = asyncio.ProactorEventLoop()
+ asyncio.set_event_loop(loop)
+ else:
+ loop = asyncio.get_event_loop()
coro = getstatusoutput(sys.executable, '-m', 'platform')
exitcode, stdout = loop.run_until_complete(coro)
if not exitcode:
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list