Skip to content
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

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Aug 2, 2022

Comment on lines -130 to -134
errors = self._errors
self._errors = None

me = BaseExceptionGroup('unhandled errors in a TaskGroup', errors)
raise me from None
Copy link
Contributor Author

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

Lib/asyncio/timeouts.py Outdated Show resolved Hide resolved
# 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
Copy link
Contributor Author

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 ?

Suggested change
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
Copy link
Contributor Author

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'

@gvanrossum gvanrossum changed the title gh-95569: make asyncio.Timeout and asyncio.TaskGroup loop-bound gh-95569: Make asyncio.timeout and asyncio.TaskGroup loop-bound Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants