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
gh-95569: Make asyncio.timeout and asyncio.TaskGroup loop-bound #95570
gh-95569: Make asyncio.timeout and asyncio.TaskGroup loop-bound #95570
Conversation
graingert
commented
Aug 2, 2022
•
edited by bedevere-bot
edited by bedevere-bot
- Issue: make asyncio.Timeout and asyncio.TaskGroup fail early when used incorrectly #95569
errors = self._errors | ||
self._errors = None | ||
|
||
me = BaseExceptionGroup('unhandled errors in a TaskGroup', errors) | ||
raise me from None |
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.
errors
and me
leave a cycle here, we need to unset them in a finally
# Exceptions are heavy objects that can have object | ||
# cycles (bad for GC); let's not keep a reference to | ||
# a bunch of them. | ||
self._errors = None |
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.
could do this so that info.append(f'errors={len(self._errors)}')
works ?
self._errors = None | |
self._errors = range(len(self._errors)) |
@@ -185,7 +186,7 @@ def _on_task_done(self, task): | |||
if self._parent_task.done(): | |||
# Not sure if this case is possible, but we want to handle |
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.
I think this is not possible because self._errors.append(exc)
on line 182 will fail first with AttributeError: 'NoneType' object has no attribute 'append'