[Python-checkins] gh-96706: [doc] Don't recomment deprecated use of get_event_loop() in examples (GH-96707)
miss-islington
webhook-mailer at python.org
Tue Sep 13 11:57:09 EDT 2022
https://github.com/python/cpython/commit/6726405ec30f7a5309ca4f5bbe32e0a7295171ab
commit: 6726405ec30f7a5309ca4f5bbe32e0a7295171ab
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-09-13T08:57:02-07:00
summary:
gh-96706: [doc] Don't recomment deprecated use of get_event_loop() in examples (GH-96707)
(cherry picked from commit 53a54b781d1f05f2d0b40ce88b3da92d5d23e9d2)
Co-authored-by: zhanpon <pon.zhan at gmail.com>
files:
M Doc/library/asyncio-eventloop.rst
M Doc/library/asyncio-llapi-index.rst
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index 555a0f5cb2a7..bd7f5f30be10 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -1663,7 +1663,7 @@ event loop::
print('Hello World')
loop.stop()
- loop = asyncio.get_event_loop()
+ loop = asyncio.new_event_loop()
# Schedule a call to hello_world()
loop.call_soon(hello_world, loop)
@@ -1699,7 +1699,7 @@ after 5 seconds, and then stops the event loop::
else:
loop.stop()
- loop = asyncio.get_event_loop()
+ loop = asyncio.new_event_loop()
# Schedule the first call to display_date()
end_time = loop.time() + 5.0
@@ -1731,7 +1731,7 @@ Wait until a file descriptor received some data using the
# Create a pair of connected file descriptors
rsock, wsock = socketpair()
- loop = asyncio.get_event_loop()
+ loop = asyncio.new_event_loop()
def reader():
data = rsock.recv(100)
diff --git a/Doc/library/asyncio-llapi-index.rst b/Doc/library/asyncio-llapi-index.rst
index cdadb7975ad4..3cec4c69f86e 100644
--- a/Doc/library/asyncio-llapi-index.rst
+++ b/Doc/library/asyncio-llapi-index.rst
@@ -267,7 +267,7 @@ See also the main documentation section about the
.. rubric:: Examples
-* :ref:`Using asyncio.get_event_loop() and loop.run_forever()
+* :ref:`Using asyncio.new_event_loop() and loop.run_forever()
<asyncio_example_lowlevel_helloworld>`.
* :ref:`Using loop.call_later() <asyncio_example_call_later>`.
More information about the Python-checkins
mailing list