-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-128552: fix refcycles in eager task creation #128553
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-128552: fix refcycles in eager task creation #128553
Conversation
graingert
commented
Jan 6, 2025
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: TaskGroup's task's exception's participate in a reference cycle, via TaskGroup.create_task -> task -> exception and loop.create_task -> task -> exception #128552
…5-01-06-18-41-08.gh-issue-128552.fV-f8j.rst
Misc/NEWS.d/next/Library/2025-01-06-18-41-08.gh-issue-128552.fV-f8j.rst
Outdated
Show resolved
Hide resolved
if possible can you add a test which uses weakref to check for refcycle |
@@ -12,11 +13,6 @@ | |||
|
|||
from test.test_asyncio.utils import await_without_task | |||
|
|||
# To prevent a warning "test altered the execution environment" |
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 know this isn't needed as you have changed it to use asyncio.EventLoop but let's keep it for now, it is easy to make a mistake on altering policy and is a pain to fix in CI if it happens without this.
|
||
self.assertIsNone(task_wr()) | ||
self.assertIsInstance(exc, _Done) | ||
self.assertListEqual(gc.get_referrers(exc), no_other_refs()) |
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 it was later changed that coro doesn't hold ref to locals, no_other_refs
should not be necessary here.
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.
Ah its not merged yet #125640
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.
Thanks
Thanks @graingert for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @graingert and @kumaraditya303, I could not cleanly backport this to
|
Thanks @graingert for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, @graingert and @kumaraditya303, I could not cleanly backport this to
|
GH-128585 is a backport of this pull request to the 3.13 branch. |
(cherry picked from commit 61b9811)
GH-128586 is a backport of this pull request to the 3.12 branch. |
GH-128586 is a backport of this pull request to the 3.12 branch. |