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

Skip to content

Commit 8778c6b

Browse files
committed
Use sys.platform instead of os.name to detect Windows in asyncio docs. Patch by Akira Li.
1 parent d65c949 commit 8778c6b

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

@@ -196,4 +196,3 @@ Access to the global loop policy
196196

197197
Set the current event loop policy. If *policy* is ``None``, the default
198198
policy is restored.
199-

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)