From 78fa3f9695c0cc1864da5ea56d8a4a0f44c4c75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20K=C3=B6tter?= Date: Sun, 6 Sep 2026 08:13:27 +0200 Subject: [PATCH] sequence - anext raises StopAsyncIteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the exception was hidden, but … --- src/aiopenapi3/request.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/aiopenapi3/request.py b/src/aiopenapi3/request.py index 62d98cc7..89e34b3b 100644 --- a/src/aiopenapi3/request.py +++ b/src/aiopenapi3/request.py @@ -583,7 +583,10 @@ async def read(self, num_bytes: int) -> bytes: if num_bytes == 0: return b"" - return await anext(self._aiter_bytes) + try: + return await anext(self._aiter_bytes) + except StopAsyncIteration: + return b"" async def aiter_json(response: httpx2.Response) -> AsyncIterator["JSON"]: reader = ReadEventStream(response)