httpx icon indicating copy to clipboard operation
httpx copied to clipboard

fix: resolve async stream resource leak on timeout

Open joao-faria-dev opened this issue 2 months ago • 0 comments

Hello everyone! I got an error when running the tests and saw that there was already a issue related to this (#3686)

Summary

Fix async stream resource leak that caused ResourceWarning in Trio, basically replacing ByteStream.aiter() async generator with a iterator that can be properly closed via aclose()

Checklist

  • [X] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • [X] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • [ ] I've updated the documentation accordingly.

joao-faria-dev avatar Oct 29 '25 19:10 joao-faria-dev