GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles by graingert · Pull Request #124959 · python/cpython Conversation
|
|
|
||
| async def __aexit__(self, et, exc, tb): | ||
| self._exiting = True | ||
| try: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't like this huge diff. Can you instead factor out the code of __aexit__ in a helper function (so that code keeps all of the existing indentation) and nest a call to it in try..finally in __aexit__?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It needs to delete locals as well as instance attributes so it's not possible
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think it is. Instance attributes are not a problem at all. Locals are solvable too:
try:
raise propagate_cancellation_error
finally:
del propagate_cancellation_error
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I pushed the changes but it introduces a bunch of extra places to delete things, so I prefer the one big try/finally. You can also just view the diff with whitespace hidden: 1a4f2b5?w=1 which should look like this:

Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lgtm, sorry for being a bit of a PITA with this review, but I think this version of the PR does read better by having most of the cleanup code more visible.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @graingert for the PR, and @1st1 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…nGH-124959) (cherry picked from commit d5dbbf4) Co-authored-by: Thomas Grainger <[email protected]>
|
Thank you Thomas! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @graingert and @1st1, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-125463 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@graingert Please submit a separate PR to 3.12, albeit I'm not sure we should port it to 3.12. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-125466 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
python#124959)" This reverts commit d5dbbf4.
…PyFuture refcycles (pythonGH-12… (pythonGH-125476) Revert "pythongh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (pythonGH-124959)" This reverts commit d5dbbf4. (cherry picked from commit e99650b) Co-authored-by: Kirill Podoprigora <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.