We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2911521 commit f4e2686Copy full SHA for f4e2686
Doc/library/asyncio-eventloop.rst
@@ -1523,9 +1523,12 @@ on Unix and :class:`ProactorEventLoop` on Windows.
1523
import asyncio
1524
import selectors
1525
1526
- selector = selectors.SelectSelector()
1527
- loop = asyncio.SelectorEventLoop(selector)
1528
- asyncio.set_event_loop(loop)
+ class MyPolicy(asyncio.DefaultEventLoopPolicy):
+ def new_event_loop(self):
+ selector = selectors.SelectSelector()
1529
+ return asyncio.SelectorEventLoop(selector)
1530
+
1531
+ asyncio.set_event_loop_policy(MyPolicy())
1532
1533
1534
.. availability:: Unix, Windows.
0 commit comments