mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-82604: fix docs about configuring selector (#97755)
This commit is contained in:
parent
a120b9f25d
commit
53503ff60e
1 changed files with 6 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue