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-115957: Close coroutine if the TaskGroup is inactive by Jason-Y-Z · Pull Request #116009 · python/cpython Conversation
|
|
Thanks for doing this! I was dangerously close to doing it myself even though I really don't have time, just for the kudos of being a "Python contributor", so I'm really glad you did 😄 My comments:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Thanks for the comments Arthur! Yeah that makes sense, I will update the wording there. Regarding the test, it raises a RuntimeWarning without the change for me. Maybe we have slightly different configs? But yeah let me try more specifically sending on the coroutine as well. Thanks again! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, to be honest I haven't actually run the tests (or for that matter cloned the CPython repo at all), I was just reading the test code. If the test suite automatically fails if there's a warning then you can ignore that comment. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
7f28db0 to
8e9866e
Compare
|
Sorry for tagging but a gentle nudge for reviewing please 🙏 @gvanrossum |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yeah, it's in my queue. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Got it, thank you 🙏 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
542d7c2 to
e7c3a5e
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It looks like the tests you changed and added still pass even if I comment out the three coro.close() calls added to taskgroups.py. While they print the RuntimeWarning message, they don't fail. Could you try to detect the warnings in at least one of the tests?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| .. versionchanged:: 3.13 | ||
|
|
||
| Close the given coroutine if the task group is not active. | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I believe that the convention is that a description of the new/changed behavior is added to the main text of the documentation (in this case the two lines right above) and then the versionchanged directive is used to clarify when this behavior was added or changed. In this case that would be a little redundant but I still feel it's appropriate.
For example, the main text could include information about when a task group is considered inactive (e.g. not yet entered, already finished, or in the process of shutting down).
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.
Thanks for the explanation! I've updated the main text
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| * When :func:`asyncio.TaskGroup.create_task` is called on an inactive | ||
| :class:`asyncio.TaskGroup`, the given coroutine will be closed (which | ||
| prevents a :exc:`RuntimeWarning`). |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'd clarify that the RuntimeWarning is about "coroutine 'blank' was never awaited".
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.
Thanks for the comments! I've updated the wording
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
22d94f3 to
5d0d518
Compare
Thanks for the detailed explanations @gvanrossum ! I have updated one of the tests so that it now explicitly captures and asserts no warning. I've tried it on my machine (MacOS) and it is now failing without the change. Please let me know if there is any other improvement I can apply. Thanks! I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @gvanrossum: please review the changes made to this pull request. |
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.
Thanks, looks good! The tests pass in CI, one of the tests fails if I undo the changes in taskgroups.py only, so I will merge.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
PS. Next time please don't force push. We squash changes when we merge into main anyway, and the force push makes it harder to re-review the code. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @gvanrossum for the review and for the note! I will remember not to force push next time 👌 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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.