]> 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)
committerGitHub <noreply@github.com>
Tue, 13 Sep 2022 15:57:02 +0000 (08:57 -0700)
(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 555a0f5cb2a72b5fce4311c18c84d6aa67ddc25f..bd7f5f30be10328432470d6dfb708df5e206c022 100644 (file)
@@ -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)
index cdadb7975ad4941a7271b5b6d95560436827e245..3cec4c69f86ea7738346146aca0289ec42c28377 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>`.