Skip to content

Commit 53a54b7

Browse files
authored
gh-96706: [doc] Don't recomment deprecated use of get_event_loop() in examples (#96707)
1 parent a36235d commit 53a54b7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Doc/library/asyncio-eventloop.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ event loop::
16751675
print('Hello World')
16761676
loop.stop()
16771677

1678-
loop = asyncio.get_event_loop()
1678+
loop = asyncio.new_event_loop()
16791679

16801680
# Schedule a call to hello_world()
16811681
loop.call_soon(hello_world, loop)
@@ -1711,7 +1711,7 @@ after 5 seconds, and then stops the event loop::
17111711
else:
17121712
loop.stop()
17131713

1714-
loop = asyncio.get_event_loop()
1714+
loop = asyncio.new_event_loop()
17151715

17161716
# Schedule the first call to display_date()
17171717
end_time = loop.time() + 5.0
@@ -1743,7 +1743,7 @@ Wait until a file descriptor received some data using the
17431743
# Create a pair of connected file descriptors
17441744
rsock, wsock = socketpair()
17451745

1746-
loop = asyncio.get_event_loop()
1746+
loop = asyncio.new_event_loop()
17471747

17481748
def reader():
17491749
data = rsock.recv(100)

Doc/library/asyncio-llapi-index.rst

+1-1
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)