Uh oh!
There was an error while loading. Please reload this page.
Ensure that all async generators are explicitly closed - #1019
Conversation
agronholm
commented
Jun 18, 2025
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 |
lovelydinosaur
commented
Jun 18, 2025
Yep. You're welcome to take the shortcut and update that here, or else issue a separate PR dealing just with that. |
agronholm
commented
Jun 23, 2025
What's the policy on Python support btw? Do you want to keep supporting the EOL'd 3.8? |
lovelydinosaur
commented
Jun 23, 2025
Okay with dropping support for EOL'd Pythons. |
Done. I also updated the |
agronholm
commented
Jun 23, 2025
Note that I had to add two |
agronholm
commented
Jun 25, 2025
I found a couple more spots where async iterables that may be generators aren't closed. |
agronholm
commented
Jun 26, 2025
@Kludex I replaced the awkward |
| coverage[toml]==7.5.4 | ||
| ruff==0.5.0 | ||
| mypy==1.16.1 | ||
| mypy==1.14.1 |
There was a problem hiding this comment.
Maybe un-downgrade mypy, since Python 3.8 support was dropped.
Kludex
commented
Jul 17, 2025
@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? 🙏 |
felixweinberger
commented
Sep 17, 2025
Hi @agronholm@Kludex just coming from modelcontextprotocol/python-sdk#946 where I think this is the last dependency update needed. It looks like this PR is approved and might just need resolution of some merge conflicts? Keen to understand if we need anything else to get this landed :) |
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