From 78bf14877bc8c5280c5a9dc52c2f65e0576855b1 Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Wed, 25 Sep 2019 17:57:18 -0400 Subject: [PATCH 01/11] Fix `asyncio.run()` docs --- Doc/library/asyncio-task.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 9f55a3534a5e0c..bdf06d24a79b6b 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -225,9 +225,10 @@ Running an asyncio Program the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. - Return a result of *coro* execution, or raise a :exc:`RuntimeError` - if ``asyncio.run()`` is called from a running event loop, or a - :exc:`ValueError` if *coro* is not a courutine. + Within the new event loop, *coro* is executed, returning the result. If + ``asyncio.run()`` is called within a running event loop, a + :exc:`RuntimeError` is raised. If *coro* is not a :term:`coroutine`, a + :exc:`ValueError` is raised. Example:: From 8af372a4a152281ecb722364a65a962d0529efea Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Wed, 25 Sep 2019 17:58:30 -0400 Subject: [PATCH 02/11] Fix `asyncio.run()` docstring --- Lib/asyncio/runners.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/asyncio/runners.py b/Lib/asyncio/runners.py index 904102bf82bef4..9f1156d77b02ee 100644 --- a/Lib/asyncio/runners.py +++ b/Lib/asyncio/runners.py @@ -21,9 +21,10 @@ def run(main, *, debug=False): It should be used as a main entry point for asyncio programs, and should ideally only be called once. - Return a result of *coro* execution, or raise a RuntimeError - if `asyncio.run()`is called from a running event loop, or a ValueError - if `main` is not a courutine. + Within the new event loop, *coro* is executed, returning the result. If + ``asyncio.run()`` is called within a running event loop, a + :exc:`RuntimeError` is raised. If *coro* is not a :term:`coroutine`, a + :exc:`ValueError` is raised. Example: From c891adb92f95b06fa43bc731078d964738e2b0b4 Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Thu, 26 Sep 2019 22:23:17 -0400 Subject: [PATCH 03/11] Add suggestion from @1st1 --- Doc/library/asyncio-task.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index bdf06d24a79b6b..541eec2f66c0f9 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -225,10 +225,9 @@ Running an asyncio Program the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. - Within the new event loop, *coro* is executed, returning the result. If - ``asyncio.run()`` is called within a running event loop, a - :exc:`RuntimeError` is raised. If *coro* is not a :term:`coroutine`, a - :exc:`ValueError` is raised. + Return the result of *coro* execution. If *coro* is not a :term:`coroutine`, + a :exc:`ValueError` is raised. + Example:: From b37528f4d903fc9aa91b32927c412c8274ddc6ab Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Thu, 26 Sep 2019 22:23:59 -0400 Subject: [PATCH 04/11] Add suggestion from @1st1 --- Lib/asyncio/runners.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Lib/asyncio/runners.py b/Lib/asyncio/runners.py index 9f1156d77b02ee..0e005270e92525 100644 --- a/Lib/asyncio/runners.py +++ b/Lib/asyncio/runners.py @@ -21,10 +21,8 @@ def run(main, *, debug=False): It should be used as a main entry point for asyncio programs, and should ideally only be called once. - Within the new event loop, *coro* is executed, returning the result. If - ``asyncio.run()`` is called within a running event loop, a - :exc:`RuntimeError` is raised. If *coro* is not a :term:`coroutine`, a - :exc:`ValueError` is raised. + Return the result of *coro* execution. If *coro* is not a :term:`coroutine`, + a :exc:`ValueError` is raised. Example: From 360bc27f564577a1fa45361e3d1c14b54c08501a Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Thu, 26 Sep 2019 22:34:33 -0400 Subject: [PATCH 05/11] Fix spacing --- Doc/library/asyncio-task.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 541eec2f66c0f9..23a5577be78872 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -225,8 +225,8 @@ Running an asyncio Program the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. - Return the result of *coro* execution. If *coro* is not a :term:`coroutine`, - a :exc:`ValueError` is raised. + Return the result of *coro* execution. If *coro* is not a :term:`coroutine`, + a :exc:`ValueError` is raised. Example:: From d69b7f927fbe229d391cb26f6355d05c22e36bb2 Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Fri, 27 Sep 2019 00:13:43 -0400 Subject: [PATCH 06/11] Fix indent --- Lib/asyncio/runners.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/asyncio/runners.py b/Lib/asyncio/runners.py index 0e005270e92525..dc63f5470812f9 100644 --- a/Lib/asyncio/runners.py +++ b/Lib/asyncio/runners.py @@ -21,8 +21,8 @@ def run(main, *, debug=False): It should be used as a main entry point for asyncio programs, and should ideally only be called once. - Return the result of *coro* execution. If *coro* is not a :term:`coroutine`, - a :exc:`ValueError` is raised. + Return the result of *coro* execution. If *coro* is not a :term:`coroutine`, + a :exc:`ValueError` is raised. Example: From 39b2f995adfeae4fc41eb816c800e30dd2ae82ca Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Fri, 27 Sep 2019 01:15:59 -0400 Subject: [PATCH 07/11] Reformat `asynco.run()` docs --- Doc/library/asyncio-task.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 23a5577be78872..fc178d43ea52c5 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -212,6 +212,8 @@ Running an asyncio Program .. function:: run(coro, \*, debug=False) + Execute the :term:`coroutine` *coro* and return the result. + This function runs the passed coroutine, taking care of managing the asyncio event loop, *finalizing asynchronous generators*, and closing the threadpool. @@ -225,10 +227,6 @@ Running an asyncio Program the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. - Return the result of *coro* execution. If *coro* is not a :term:`coroutine`, - a :exc:`ValueError` is raised. - - Example:: async def main(): From 00e45fc758337282144fc3be57a3a859e4fb39df Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Fri, 27 Sep 2019 01:17:32 -0400 Subject: [PATCH 08/11] Reformat `asyncio.run()` docstring --- Lib/asyncio/runners.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Lib/asyncio/runners.py b/Lib/asyncio/runners.py index dc63f5470812f9..da1b87d5bac4ba 100644 --- a/Lib/asyncio/runners.py +++ b/Lib/asyncio/runners.py @@ -6,7 +6,7 @@ def run(main, *, debug=False): - """Run a coroutine. + """Execute the coroutine *coro* and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop and finalizing asynchronous @@ -21,9 +21,6 @@ def run(main, *, debug=False): It should be used as a main entry point for asyncio programs, and should ideally only be called once. - Return the result of *coro* execution. If *coro* is not a :term:`coroutine`, - a :exc:`ValueError` is raised. - Example: async def main(): From 0d36a686e485387bd9cd7f2fcb42854a1053a89e Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Fri, 27 Sep 2019 01:18:29 -0400 Subject: [PATCH 09/11] Remove extra space --- Doc/library/asyncio-task.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index fc178d43ea52c5..155887a3ab3af9 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -212,7 +212,7 @@ Running an asyncio Program .. function:: run(coro, \*, debug=False) - Execute the :term:`coroutine` *coro* and return the result. + Execute the :term:`coroutine` *coro* and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop, *finalizing asynchronous From b48faa45959656edbfa1e9243bc593be08432dec Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Fri, 27 Sep 2019 01:32:26 -0400 Subject: [PATCH 10/11] Adjust `asyncio.run()` docstring --- Lib/asyncio/runners.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/asyncio/runners.py b/Lib/asyncio/runners.py index da1b87d5bac4ba..03ce33300eba83 100644 --- a/Lib/asyncio/runners.py +++ b/Lib/asyncio/runners.py @@ -6,7 +6,7 @@ def run(main, *, debug=False): - """Execute the coroutine *coro* and return the result. + """Execute the coroutine and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop and finalizing asynchronous From 0aff6279a1df11acdc83e86e46b2e2f6cebe065d Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Fri, 27 Sep 2019 15:51:09 -0400 Subject: [PATCH 11/11] Fix typo in glossary entry for coroutine --- Doc/glossary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index e601e8b3698410..9ce0357f1cb424 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -247,7 +247,7 @@ Glossary Fortran contiguous arrays, the first index varies the fastest. coroutine - Coroutines is a more generalized form of subroutines. Subroutines are + Coroutines are a more generalized form of subroutines. Subroutines are entered at one point and exited at another point. Coroutines can be entered, exited, and resumed at many different points. They can be implemented with the :keyword:`async def` statement. See also