]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96706: [doc] Don't recomment deprecated use of get_event_loop() in examples (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 13 Sep 2022 15:57:02 +0000 (08:57 -0700)
committerPablo Galindo <pablogsal@gmail.com>
Sat, 22 Oct 2022 19:06:17 +0000 (20:06 +0100)
(cherry picked from commit 53a54b781d1f05f2d0b40ce88b3da92d5d23e9d2)

Co-authored-by: zhanpon <pon.zhan@gmail.com>
Doc/library/asyncio-eventloop.rst
Doc/library/asyncio-llapi-index.rst

index 15f4f04fbe9ac3950e0fb6e5ce041f3b4ec67421..93bca96fff6f10b679f8afda21b40e932643c2ad 100644 (file)
@@ -1699,7 +1699,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)
@@ -1735,7 +1735,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
@@ -1767,7 +1767,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)
index c787cb930d478171123c9a39616392a71b067b5a..b7ad888a7b67ab52c3c26f401407a55ea5616883 100644 (file)
@@ -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>`.