diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2022-10-04 16:45:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 16:45:37 (GMT) |
commit | 53503ff60e9a4727af0d9a1096418675e72a0fae (patch) | |
tree | b6cddf33b7a045c8cadc56840f1e228c9e892016 /Doc/library/asyncio-eventloop.rst | |
parent | a120b9f25d037a1c794df731f8cc6a2898a9165e (diff) | |
download | cpython-53503ff60e9a4727af0d9a1096418675e72a0fae.zip cpython-53503ff60e9a4727af0d9a1096418675e72a0fae.tar.gz cpython-53503ff60e9a4727af0d9a1096418675e72a0fae.tar.bz2 |
GH-82604: fix docs about configuring selector (#97755)
Diffstat (limited to 'Doc/library/asyncio-eventloop.rst')
-rw-r--r-- | Doc/library/asyncio-eventloop.rst | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 0a960ab..c51990e 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1632,9 +1632,12 @@ on Unix and :class:`ProactorEventLoop` on Windows. import asyncio import selectors - selector = selectors.SelectSelector() - loop = asyncio.SelectorEventLoop(selector) - asyncio.set_event_loop(loop) + class MyPolicy(asyncio.DefaultEventLoopPolicy): + def new_event_loop(self): + selector = selectors.SelectSelector() + return asyncio.SelectorEventLoop(selector) + + asyncio.set_event_loop_policy(MyPolicy()) .. availability:: Unix, Windows. |