bpo-34790: Document how passing coroutines to asyncio.wait() can be confusing.#9543
bpo-34790: Document how passing coroutines to asyncio.wait() can be confusing.#95431st1 merged 3 commits intopython:masterfrom
Conversation
|
cc @elprans |
Doc/library/asyncio-task.rst
Outdated
|
|
||
| If any awaitable in *aws* is a coroutine, it is automatically | ||
| scheduled as a Task. | ||
| scheduled as a Task. Although passing coroutines objects to |
What do you think about deprecating the current wait() design and fixing it in a couple releases? |
|
I'd like to deprecate passing regular coroutines into |
|
Creating a task if a coroutine is passed to a function is too... implicit. |
Radical :) I agree, it's confusing. Although maybe we can keep |
|
Thanks @1st1 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
…ng. (pythonGH-9543) (cherry picked from commit 996859a) Co-authored-by: Yury Selivanov <[email protected]>
|
GH-9577 is a backport of this pull request to the 3.7 branch. |
|
Yes, people prefer |
…ng. (GH-9543) (cherry picked from commit 996859a) Co-authored-by: Yury Selivanov <[email protected]>
Yep!
It can be very annoying in large codebases though. I think it's a good idea to use |
+1 |
Under some circumstances (see <xonsh/xonsh#3907>) a DeprecationWarning would be printed. This is because of passing coroutine objects directly to asyncio.wait(), which is confusing behaviour that has been deprecated. <python/cpython#9543> gives information on how to refactor code that uses the deprecated method. Signed-off-by: Carmen Bianca Bakker <[email protected]>
* Prevent asyncio DeprecationWarning Under some circumstances (see <xonsh/xonsh#3907>) a DeprecationWarning would be printed. This is because of passing coroutine objects directly to asyncio.wait(), which is confusing behaviour that has been deprecated. <python/cpython#9543> gives information on how to refactor code that uses the deprecated method. Signed-off-by: Carmen Bianca Bakker <[email protected]>
|
This makes a simple timeouted wait even more complicated than it was already. You should consider adding timeout to wait() functions then. What we had: Now we have two options: or |
https://bugs.python.org/issue34790