Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bbfcb38

Browse files
author
Guido van Rossum
committed
Use sys.platform instead of os.name to detect Windows in asyncio docs. Patch by Akira Li. (Merge 3.5->3.6)
2 parents 4a7c03a + 26825bc commit bbfcb38

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

Doc/library/asyncio-eventloops.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ asyncio currently provides two implementations of event loops:
5757

5858
Example to use a :class:`ProactorEventLoop` on Windows::
5959

60-
import asyncio, os
60+
import asyncio, sys
6161

62-
if os.name == 'nt':
62+
if sys.platform == 'win32':
6363
loop = asyncio.ProactorEventLoop()
6464
asyncio.set_event_loop(loop)
6565

@@ -198,4 +198,3 @@ Access to the global loop policy
198198

199199
Set the current event loop policy. If *policy* is ``None``, the default
200200
policy is restored.
201-

Doc/library/asyncio-subprocess.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ On Windows, the default event loop is :class:`SelectorEventLoop` which does not
1212
support subprocesses. :class:`ProactorEventLoop` should be used instead.
1313
Example to use it on Windows::
1414

15-
import asyncio, os
15+
import asyncio, sys
1616

17-
if os.name == 'nt':
17+
if sys.platform == 'win32':
1818
loop = asyncio.ProactorEventLoop()
1919
asyncio.set_event_loop(loop)
2020

0 commit comments

Comments
 (0)