mirror of https://github.com/python/cpython.git
GH-82604: fix docs about configuring selector (GH-97755)
(cherry picked from commit 53503ff60e
)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
parent
3263aaf83f
commit
0dcfe0f47e
|
@ -1611,9 +1611,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.
|
||||
|
|
Loading…
Reference in New Issue