We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9d49bd4 commit c6bf822Copy full SHA for c6bf822
Doc/library/asyncio-eventloop.rst
@@ -1638,9 +1638,12 @@ on Unix and :class:`ProactorEventLoop` on Windows.
1638
import asyncio
1639
import selectors
1640
1641
- selector = selectors.SelectSelector()
1642
- loop = asyncio.SelectorEventLoop(selector)
1643
- asyncio.set_event_loop(loop)
+ class MyPolicy(asyncio.DefaultEventLoopPolicy):
+ def new_event_loop(self):
+ selector = selectors.SelectSelector()
1644
+ return asyncio.SelectorEventLoop(selector)
1645
+
1646
+ asyncio.set_event_loop_policy(MyPolicy())
1647
1648
1649
.. availability:: Unix, Windows.
0 commit comments