[Python-checkins] GH-82604: fix docs about configuring selector (GH-97755)
miss-islington
webhook-mailer at python.org
Tue Oct 4 12:52:33 EDT 2022
https://github.com/python/cpython/commit/0dcfe0f47e471192c87d730c7d2ff3a2579e999f
commit: 0dcfe0f47e471192c87d730c7d2ff3a2579e999f
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-10-04T09:52:28-07:00
summary:
GH-82604: fix docs about configuring selector (GH-97755)
(cherry picked from commit 53503ff60e9a4727af0d9a1096418675e72a0fae)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>
files:
M Doc/library/asyncio-eventloop.rst
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index 5e951652f537..b83e6ace5589 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -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.
More information about the Python-checkins
mailing list