[issue25887] awaiting on coroutine more than once should be an error

Nick Coghlan report at bugs.python.org
Tue Jan 12 00:39:36 EST 2016


Nick Coghlan added the comment:

Sorry, dropping the "was" was a typo (I should have copied & pasted it instead of rewriting).

>From the point of view of the error message, the reason I changed my suggestion was because I liked your idea of optimising it for the "only using await" case and trusting that the folks delving into the lower level plumbing of calling methods manually can figure it out. Anything that mentions await *at all* will be wrong in some cases, since what we're actually reporting is an attempt to resume (by some means) a coroutine that was previously terminated (by some means).

That is, "Cannot resume terminated coroutine" is always accurate, but relies on the reader knowing that "await" both resumes a coroutine and waits for it to terminate.

"Coroutine was previously awaited on" may be wrong about how the coroutine was originally terminated, but at least hints that the error may be related to awaiting the coroutine.

"Cannot resume previously awaited coroutine" would be inaccurate under the same circumstances.

"Cannot await previously awaited coroutine" would only be entirely accurate for "double await" errors, but doesn't rely on the reader making any assumptions at all in that case.

(The bulk of the problem here is that my brain is happy to accept "awaited" as a novel adjective modifying "coroutine", but balks at "awaited" as a verb or "awaited on" as a verb phrase. I'm extrapolating from that to guess that other folks would find the verb form similarly jarring)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25887>
_______________________________________


More information about the Python-bugs-list mailing list