mirror of
https://github.com/python/cpython.git
synced 2025-10-03 13:45:29 +00:00
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
9d49bd4773
commit
c6bf822a89
1 changed files with 6 additions and 3 deletions
|
@ -1638,9 +1638,12 @@ on Unix and :class:`ProactorEventLoop` on Windows.
|
||||||
import asyncio
|
import asyncio
|
||||||
import selectors
|
import selectors
|
||||||
|
|
||||||
selector = selectors.SelectSelector()
|
class MyPolicy(asyncio.DefaultEventLoopPolicy):
|
||||||
loop = asyncio.SelectorEventLoop(selector)
|
def new_event_loop(self):
|
||||||
asyncio.set_event_loop(loop)
|
selector = selectors.SelectSelector()
|
||||||
|
return asyncio.SelectorEventLoop(selector)
|
||||||
|
|
||||||
|
asyncio.set_event_loop_policy(MyPolicy())
|
||||||
|
|
||||||
|
|
||||||
.. availability:: Unix, Windows.
|
.. availability:: Unix, Windows.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue