Closed mecampbellsoup closed 1 week ago
Would you be able to create a minimal workable example that demonstrates this issue? I'm not convinced that AnyIO is the real culprit here.
This might be helpful @agronholm https://github.com/tiangolo/fastapi/discussions/11652 ... I"m getting the same behaviour
Pin anyio to 4.3.0. The test should pass.
Bump anyio to 4.4.0. The test should now error.
There is one place in MemoryObjectReceiveStream
where such an AttributeError
occurs, but it is caught and an EndOfStream
is raised in its place. So it doesn't make sense that the AttributeError
would be uncaught, as is implied in this bug report.
This was fixed by #767. Let me know if it wasn't.
@agronholm tested using commit f6750c802e862941fd356bae28753c441aea2ab5
and works perfect, thanks a lot for the work!!!
@agronholm Can we have a new release (4.4.1) with this bug fix?
The next release will be v4.5.0 which is only pending my finalization of a fix for #695, and the review and merging of a number of outstanding PRs.
Things to check first
[X] I have searched the existing issues and didn't find my bug already reported there
[X] I have checked that my bug is still present in the latest release
AnyIO version
4.4.0
Python version
3.11.9
What happened?
After bumping anyio from 4.3.0 to 4.4.0, one of our tests that depends on
starlette.testclient.TestClient
began to fail.Here is the ASGI lifespan code under test:
And here is the test itself:
Finally, here is the newly-encountered exception:
I added some
print
statements aroundanyio/from_thread.py
to see what is failing internally:How can we reproduce the bug?
Create a starlette/fastapi application with a test or otherwise that uses
starlette.testclient.TestClient
; in the ASGI lifespan async context manager, create/yield/cancel a task like so:Pin anyio to 4.3.0. The test should pass. Bump anyio to 4.4.0. The test should now error.