Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 53503ff

Browse filesBrowse files
GH-82604: fix docs about configuring selector (#97755)
1 parent a120b9f commit 53503ff
Copy full SHA for 53503ff

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed

‎Doc/library/asyncio-eventloop.rst

Copy file name to clipboardExpand all lines: Doc/library/asyncio-eventloop.rst
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,9 +1632,12 @@ on Unix and :class:`ProactorEventLoop` on Windows.
16321632
import asyncio
16331633
import selectors
16341634

1635-
selector = selectors.SelectSelector()
1636-
loop = asyncio.SelectorEventLoop(selector)
1637-
asyncio.set_event_loop(loop)
1635+
class MyPolicy(asyncio.DefaultEventLoopPolicy):
1636+
def new_event_loop(self):
1637+
selector = selectors.SelectSelector()
1638+
return asyncio.SelectorEventLoop(selector)
1639+
1640+
asyncio.set_event_loop_policy(MyPolicy())
16381641

16391642

16401643
.. availability:: Unix, Windows.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.