]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96706: [doc] Don't recomment deprecated use of get_event_loop() in examples (...
authorzhanpon <pon.zhan@gmail.com>
Sun, 11 Sep 2022 19:56:30 +0000 (04:56 +0900)
committerGitHub <noreply@github.com>
Sun, 11 Sep 2022 19:56:30 +0000 (12:56 -0700)
Doc/library/asyncio-eventloop.rst
Doc/library/asyncio-llapi-index.rst

index c86da8c31f6e7accd6e40e821a7a2b855a37f392..ef0f6fc8e68cd4fa9f68d692338f4d376d091a8a 100644 (file)
@@ -1675,7 +1675,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)
@@ -1711,7 +1711,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
@@ -1743,7 +1743,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>`.