mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
gh-96706: [doc] Don't recomment deprecated use of get_event_loop() in examples (#96707)
This commit is contained in:
parent
a36235d5c7
commit
53a54b781d
2 changed files with 4 additions and 4 deletions
|
|
@ -1675,7 +1675,7 @@ event loop::
|
||||||
print('Hello World')
|
print('Hello World')
|
||||||
loop.stop()
|
loop.stop()
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
|
|
||||||
# Schedule a call to hello_world()
|
# Schedule a call to hello_world()
|
||||||
loop.call_soon(hello_world, loop)
|
loop.call_soon(hello_world, loop)
|
||||||
|
|
@ -1711,7 +1711,7 @@ after 5 seconds, and then stops the event loop::
|
||||||
else:
|
else:
|
||||||
loop.stop()
|
loop.stop()
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
|
|
||||||
# Schedule the first call to display_date()
|
# Schedule the first call to display_date()
|
||||||
end_time = loop.time() + 5.0
|
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
|
# Create a pair of connected file descriptors
|
||||||
rsock, wsock = socketpair()
|
rsock, wsock = socketpair()
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
|
|
||||||
def reader():
|
def reader():
|
||||||
data = rsock.recv(100)
|
data = rsock.recv(100)
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ See also the main documentation section about the
|
||||||
|
|
||||||
.. rubric:: Examples
|
.. 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>`.
|
<asyncio_example_lowlevel_helloworld>`.
|
||||||
|
|
||||||
* :ref:`Using loop.call_later() <asyncio_example_call_later>`.
|
* :ref:`Using loop.call_later() <asyncio_example_call_later>`.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue