Skip to content

Commit e407013

Browse files
aeros1st1
authored andcommitted
Fix and improve asyncio.run() docs (GH-16403)
1 parent aca8c40 commit e407013

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
@@ -247,7 +247,7 @@ Glossary
247247
Fortran contiguous arrays, the first index varies the fastest.
248248

249249
coroutine
250-
Coroutines is a more generalized form of subroutines. Subroutines are
250+
Coroutines are a more generalized form of subroutines. Subroutines are
251251
entered at one point and exited at another point. Coroutines can be
252252
entered, exited, and resumed at many different points. They can be
253253
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, *finalizing asynchronous
217219
generators*, and closing the threadpool.
@@ -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)