Skip to content

Commit 2eb1dac

Browse files
miss-islingtonaeros
authored andcommitted
Fix and improve asyncio.run() docs (GH-16403) (GH-16505)
(cherry picked from commit e407013) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
1 parent 1c3e469 commit 2eb1dac

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

Doc/glossary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ Glossary
243243
Fortran contiguous arrays, the first index varies the fastest.
244244

245245
coroutine
246-
Coroutines is a more generalized form of subroutines. Subroutines are
246+
Coroutines are a more generalized form of subroutines. Subroutines are
247247
entered at one point and exited at another point. Coroutines can be
248248
entered, exited, and resumed at many different points. They can be
249249
implemented with the :keyword:`async def` statement. See also

Doc/library/asyncio-task.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ Running an asyncio Program
212212

213213
.. function:: run(coro, \*, debug=False)
214214

215+
Execute the :term:`coroutine` *coro* and return the result.
216+
215217
This function runs the passed coroutine, taking care of
216218
managing the asyncio event loop and *finalizing asynchronous
217219
generators*.
@@ -225,10 +227,6 @@ Running an asyncio Program
225227
the end. It should be used as a main entry point for asyncio
226228
programs, and should ideally only be called once.
227229

228-
Return a result of *coro* execution, or raise a :exc:`RuntimeError`
229-
if ``asyncio.run()`` is called from a running event loop, or a
230-
:exc:`ValueError` if *coro* is not a courutine.
231-
232230
Example::
233231

234232
async def main():

Lib/asyncio/runners.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def run(main, *, debug=False):
9-
"""Run a coroutine.
9+
"""Execute the coroutine and return the result.
1010
1111
This function runs the passed coroutine, taking care of
1212
managing the asyncio event loop and finalizing asynchronous
@@ -21,10 +21,6 @@ def run(main, *, debug=False):
2121
It should be used as a main entry point for asyncio programs, and should
2222
ideally only be called once.
2323
24-
Return a result of *coro* execution, or raise a RuntimeError
25-
if `asyncio.run()`is called from a running event loop, or a ValueError
26-
if `main` is not a courutine.
27-
2824
Example:
2925
3026
async def main():

0 commit comments

Comments
 (0)