-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Occasional incorrect chaining of CancelledError when calling 'cancel' on result of 'asyncio.gather' #97907
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
Comments
Note that |
Actually on the final 3.11 release cancel(msg) will be undeprecated — we had a last minute change of heart. So if there’s an issue it may have to be addressed — in 3.12, probably. |
@gvanrossum in that case should I remove the deprecation warning from latest dev branch, or that's already planned to be done by someone? |
We already removed it. |
On the original issue, I suppose we could do better -- a PR would be appreciated. |
At present when cancelling the result of an :func:`asncio.gather` call, the last child is used to create the cancellation error. If that was not cancelled but another child was, its cancellation message and traceback will be lost. Fix this by using the cancellation error from the first of the children to be cancelled, if any, falling back to the last child only if none have been.
Uh oh!
There was an error while loading. Please reload this page.
Currently traceback and description parts of
CancelledError
depend upon the order of arguments that were passed intoasyncio.gather
. The reason I believe is this: herefut
would be bound to the last item inchildren
which might or might not correspond to the cancelled task and instead it should probably be one of tasks that were actually cancelled (which is still not ideal since there might be many of them but I guess withgather
it is as good as it can be).Linked PRs
The text was updated successfully, but these errors were encountered: