Skip to content

Commit c6bf822

Browse files
miss-islingtonkumaraditya303
authored andcommitted
GH-82604: fix docs about configuring selector (GH-97755)
(cherry picked from commit 53503ff) Co-authored-by: Kumar Aditya <[email protected]>
1 parent 9d49bd4 commit c6bf822

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,9 +1638,12 @@ on Unix and :class:`ProactorEventLoop` on Windows.
16381638
import asyncio
16391639
import selectors
16401640

1641-
selector = selectors.SelectSelector()
1642-
loop = asyncio.SelectorEventLoop(selector)
1643-
asyncio.set_event_loop(loop)
1641+
class MyPolicy(asyncio.DefaultEventLoopPolicy):
1642+
def new_event_loop(self):
1643+
selector = selectors.SelectSelector()
1644+
return asyncio.SelectorEventLoop(selector)
1645+
1646+
asyncio.set_event_loop_policy(MyPolicy())
16441647

16451648

16461649
.. availability:: Unix, Windows.

0 commit comments

Comments
 (0)