-
Notifications
You must be signed in to change notification settings - Fork 122
Ensure that all async generators are explicitly closed #1019
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
base: master
Are you sure you want to change the base?
Conversation
There are no new tests but I've removed the xfail markers for the existing cancellation tests. |
Would it be okay to upgrade Mypy? Later versions are fine with the single type parameter to |
Yep. You're welcome to take the shortcut and update that here, or else issue a separate PR dealing just with that. |
What's the policy on Python support btw? Do you want to keep supporting the EOL'd 3.8? |
Okay with dropping support for EOL'd Pythons. |
Done. I also updated the |
Note that I had to add two |
I found a couple more spots where async iterables that may be generators aren't closed. |
@Kludex I replaced the awkward |
requirements.txt
Outdated
@@ -15,7 +15,7 @@ twine==6.1.0 | |||
# Tests & Linting | |||
coverage[toml]==7.5.4 | |||
ruff==0.5.0 | |||
mypy==1.16.1 | |||
mypy==1.14.1 |
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.
Maybe un-downgrade mypy, since Python 3.8 support was dropped.
@tomchristie This PR and the one in httpx are pre-requisites to a PR @agronholm is working in here: modelcontextprotocol/python-sdk#946 (I'm helping on that project). I know I have merge rights here, but I don't feel comfortable merging here. 👀 Would you mind checking if something is needed on those PRs to move forward? 🙏 |
Summary
This change avoids warnings on Trio by explicitly closing all async generators rather than relying on the garbage collector to do so, as this may cause unpredictable behavior due to different GC implementations.
Checklist