Issue 25888: awaiting on coroutine that is being awaited should be an error (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/70076

classification

Title: awaiting on coroutine that is being awaited should be an error
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.6, Python 3.5

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: yselivanov Nosy List: asvetlov, brett.cannon, gvanrossum, martin.panter, ncoghlan, python-dev, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2015-12-16 21:51 by yselivanov, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Issue25888.patch yselivanov,2015-12-17 21:24 review
Messages (7)
msg256539 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-12-16 21:51
This problem was discussed in one of the asyncio issues here: https://github.com/python/asyncio/issues/288 I propose to raise a RuntimeError if an 'await' expression is used for a coroutine object that's being awaited on already. This change shouldn't impact performance in any way. It will prevent users from writing code that behaves in a very weird ways (see the github link for an example).
msg256565 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2015-12-16 23:42
Right.
msg256615 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-12-17 21:24
The patch is attached, please review.
msg258043 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-01-12 00:07
Will commit this patch tomorrow to 3.5 and 3.6. It only affects coroutines (async defs): if an await expression is used on a coroutine object while it's being already awaited by another coroutine, a `RuntimeError("coroutine is being awaited already")` will be triggered.
msg258046 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-01-12 01:07
Missing word in a comment on the review
msg261125 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-02 16:31
New changeset e16084e07761 by Yury Selivanov in branch '3.5': coroutines: Error when awaiting on coroutine that's being awaited https://hg.python.org/cpython/rev/e16084e07761 New changeset 2218ce5c592f by Yury Selivanov in branch 'default': Merge 3.5 (issue #25888) https://hg.python.org/cpython/rev/2218ce5c592f
msg261126 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-03-02 16:33
Committed. Thanks for the review, Martin!
History
Date User Action Args
2022-04-11 14:58:25 admin set github: 70076
2016-03-02 16:33:32 yselivanov set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2016-03-02 16:31:43 python-dev set nosy: + python-devmessages: +
2016-01-12 01:07:28 martin.panter set nosy: + martin.pantermessages: +
2016-01-12 00:07:49 yselivanov set messages: +
2015-12-17 21:24:01 yselivanov set files: + Issue25888.patchkeywords: + patchmessages: + stage: patch review
2015-12-17 17:33:31 brett.cannon set nosy: + brett.cannon
2015-12-16 23:42:35 gvanrossum set messages: +
2015-12-16 21:51:12 yselivanov create