Skip to content

Commit 6726405

Browse files
gh-96706: [doc] Don't recomment deprecated use of get_event_loop() in examples (GH-96707)
(cherry picked from commit 53a54b7) Co-authored-by: zhanpon <[email protected]>
1 parent cc8b006 commit 6726405

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ event loop::
16631663
print('Hello World')
16641664
loop.stop()
16651665

1666-
loop = asyncio.get_event_loop()
1666+
loop = asyncio.new_event_loop()
16671667

16681668
# Schedule a call to hello_world()
16691669
loop.call_soon(hello_world, loop)
@@ -1699,7 +1699,7 @@ after 5 seconds, and then stops the event loop::
16991699
else:
17001700
loop.stop()
17011701

1702-
loop = asyncio.get_event_loop()
1702+
loop = asyncio.new_event_loop()
17031703

17041704
# Schedule the first call to display_date()
17051705
end_time = loop.time() + 5.0
@@ -1731,7 +1731,7 @@ Wait until a file descriptor received some data using the
17311731
# Create a pair of connected file descriptors
17321732
rsock, wsock = socketpair()
17331733

1734-
loop = asyncio.get_event_loop()
1734+
loop = asyncio.new_event_loop()
17351735

17361736
def reader():
17371737
data = rsock.recv(100)

Doc/library/asyncio-llapi-index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ See also the main documentation section about the
267267

268268
.. rubric:: Examples
269269

270-
* :ref:`Using asyncio.get_event_loop() and loop.run_forever()
270+
* :ref:`Using asyncio.new_event_loop() and loop.run_forever()
271271
<asyncio_example_lowlevel_helloworld>`.
272272

273273
* :ref:`Using loop.call_later() <asyncio_example_call_later>`.

0 commit comments

Comments
 (0)