Skip to content

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

Merged
merged 13 commits into from
Jan 7, 2025

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Jan 6, 2025

@graingert graingert marked this pull request as ready for review January 6, 2025 18:45
@kumaraditya303
Copy link
Contributor

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"
Copy link
Contributor

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.

@kumaraditya303 kumaraditya303 self-assigned this Jan 7, 2025

self.assertIsNone(task_wr())
self.assertIsInstance(exc, _Done)
self.assertListEqual(gc.get_referrers(exc), no_other_refs())
Copy link
Contributor

@kumaraditya303 kumaraditya303 Jan 7, 2025

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.

Copy link
Contributor

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

Copy link
Contributor

@kumaraditya303 kumaraditya303 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@kumaraditya303 kumaraditya303 enabled auto-merge (squash) January 7, 2025 11:42
@kumaraditya303 kumaraditya303 merged commit 61b9811 into python:main Jan 7, 2025
42 checks passed
@graingert graingert added the needs backport to 3.13 bugs and security fixes label Jan 7, 2025
@miss-islington-app
Copy link

Thanks @graingert for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @graingert and @kumaraditya303, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 61b9811ac6843e22b5896ef96030d421b79cd892 3.13

@graingert graingert added the needs backport to 3.12 only security fixes label Jan 7, 2025
@miss-islington-app
Copy link

Thanks @graingert for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @graingert and @kumaraditya303, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 61b9811ac6843e22b5896ef96030d421b79cd892 3.12

@graingert graingert deleted the fix-taskgroup-eager-refcycle branch January 7, 2025 11:46
@bedevere-app
Copy link

bedevere-app bot commented Jan 7, 2025

GH-128585 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 7, 2025
graingert added a commit to graingert/cpython that referenced this pull request Jan 7, 2025
@bedevere-app
Copy link

bedevere-app bot commented Jan 7, 2025

GH-128586 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Jan 7, 2025
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
kumaraditya303 pushed a commit that referenced this pull request Jan 8, 2025
…8585)

gh-128552: fix refcycles in eager task creation (#128553)

(cherry picked from commit 61b9811)
@bedevere-app
Copy link

bedevere-app bot commented Jan 20, 2025

GH-128586 is a backport of this pull request to the 3.12 branch.

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.

3 participants