Issue 34802: asyncio.iscoroutine() documentation is wrong (original) (raw)

Created on 2018-09-25 20:32 by abcd, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9611 merged yselivanov,2018-09-27 19:39
PR 9612 merged miss-islington,2018-09-27 19:48
PR 9625 closed yselivanov,2018-09-28 16:21
Messages (6)
msg326404 - (view) Author: (abcd) Date: 2018-09-25 20:32
The documentation states that "This method is different from inspect.iscoroutine() because it returns True for generator-based coroutines decorated with @coroutine." It seems to be wrong, a method written as follow: def test(): yield 1 will be evaluated as a coroutine by asyncio.iscoroutine(), even if not decorated. The old doc stated "Return True if obj is a coroutine object, which may be based on a generator or an async def coroutine.", which seems more correct.
msg326415 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-09-26 01:44
Thanks for the report. I believe this was done as part asyncio docs overhaul and I am adding Yury here. The current docs link to #coroutine from asyncio.iscoroutine whereas the previous docs had the definition inline. I think this is clarified in #awaitables section but takes a round-trip and it's not in #coroutines section which is linked in asyncio.iscoroutine. The below is present in important note in #awaitables and may be this can be added to #coroutine too so that it's not last? Suggestions welcome > asyncio also supports legacy generator-based coroutines I would suggest below for #coroutines : > Coroutines declared with async/await syntax is the preferred way of writing asyncio applications but asyncio also supports legacy generator-based coroutines. Thanks
msg326587 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-09-27 19:42
I'll make a simple fix for the asyncio.coroutine decorator docs. > I would suggest below for #coroutines : >> Coroutines declared with async/await syntax is the preferred way of writing asyncio applications but asyncio also supports legacy generator-based coroutines. I don't want to further emphasize generator-based coroutines beyond how they are covered right now. We'll drop support for them in a just a couple of versions anyways.
msg326588 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-09-27 19:48
New changeset 59ee5b12938efbf534f2a19300a847bf6b23a77d by Yury Selivanov in branch 'master': bpo-34802: Fix asyncio.iscoroutine() docs (GH-9611) https://github.com/python/cpython/commit/59ee5b12938efbf534f2a19300a847bf6b23a77d
msg326589 - (view) Author: miss-islington (miss-islington) Date: 2018-09-27 19:53
New changeset 85ccedc5b57ddda198e7176ba787e3896435c504 by Miss Islington (bot) in branch '3.7': bpo-34802: Fix asyncio.iscoroutine() docs (GH-9611) https://github.com/python/cpython/commit/85ccedc5b57ddda198e7176ba787e3896435c504
msg326591 - (view) Author: (abcd) Date: 2018-09-27 20:20
I think it's much clearer
History
Date User Action Args
2022-04-11 14:59:06 admin set github: 78983
2018-09-28 16:21:38 yselivanov set pull_requests: + <pull%5Frequest9023>
2018-09-27 20:20:44 abcd set messages: +
2018-09-27 19:57:08 yselivanov set status: open -> closedresolution: fixedstage: patch review -> resolved
2018-09-27 19:53:22 miss-islington set nosy: + miss-islingtonmessages: +
2018-09-27 19:48:44 miss-islington set pull_requests: + <pull%5Frequest9010>
2018-09-27 19:48:33 yselivanov set messages: +
2018-09-27 19:42:03 yselivanov set versions: + Python 3.8nosy: + docs@pythonmessages: + assignee: docs@pythoncomponents: + Documentation, asyncio
2018-09-27 19:39:27 yselivanov set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest9009>
2018-09-27 19:34:03 brett.cannon set nosy: + asvetlov
2018-09-26 01:44:51 xtreak set nosy: + xtreak, yselivanovmessages: +
2018-09-25 20:32:06 abcd create