-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-34790: Document how passing coroutines to asyncio.wait() can be confusing. #9543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop "although".
asvetlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat example :)
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