From 29303217e0dc5f0bc469833ebed8475c04bf1093 Mon Sep 17 00:00:00 2001 From: Lalith Kothuru Date: Sun, 23 Aug 2026 18:23:49 -0500 Subject: [PATCH 1/3] Fix documented default for StreamReader.read_nowait (#13295) --- CHANGES/13295.doc.rst | 3 +++ docs/streams.rst | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 CHANGES/13295.doc.rst diff --git a/CHANGES/13295.doc.rst b/CHANGES/13295.doc.rst new file mode 100644 index 00000000000..545c17bf3a7 --- /dev/null +++ b/CHANGES/13295.doc.rst @@ -0,0 +1,3 @@ +Corrected the documented signature of :meth:`~aiohttp.StreamReader.read_nowait`, +whose ``n`` parameter defaults to ``-1`` rather than the ``None`` that was +previously documented -- by :user:`LALITH0110`. diff --git a/docs/streams.rst b/docs/streams.rst index d87e945e904..c74a0c1ad93 100644 --- a/docs/streams.rst +++ b/docs/streams.rst @@ -196,7 +196,7 @@ Helpers Return ``True`` if the buffer is empty and EOF was reached. -.. method:: StreamReader.read_nowait(n=None) +.. method:: StreamReader.read_nowait(n=-1) Returns data from internal buffer if any, empty bytes object otherwise. From 664b1d2a705d86974ec516005fb8b40bc85f0c16 Mon Sep 17 00:00:00 2001 From: Bogdan Galushko <84540747+bagowix@users.noreply.github.com> Date: Mon, 24 Aug 2026 05:17:23 +0400 Subject: [PATCH 2/3] Add interlock-cb to third-party libraries (#13336) --- CHANGES/13336.doc.rst | 2 ++ docs/third_party.rst | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 CHANGES/13336.doc.rst diff --git a/CHANGES/13336.doc.rst b/CHANGES/13336.doc.rst new file mode 100644 index 00000000000..a159ba00f04 --- /dev/null +++ b/CHANGES/13336.doc.rst @@ -0,0 +1,2 @@ +Added ``interlock-cb``, an aiohttp client circuit breaker middleware, to the +third-party libraries page -- by :user:`bagowix`. diff --git a/docs/third_party.rst b/docs/third_party.rst index 9cc7d017298..d8f9dc992c6 100644 --- a/docs/third_party.rst +++ b/docs/third_party.rst @@ -302,3 +302,7 @@ ask to raise the status. - `aiointercept `_ Mock aiohttp HTTP requests by routing them through a real aiohttp.web test server. + +- `interlock-cb `_ + Circuit breaker middleware for aiohttp clients with one breaker per host; it fails fast + while a host is degraded and trips on failure rate or slow responses. From fdebfa2b81c7f85c6dccddcbf4ab45d311970b03 Mon Sep 17 00:00:00 2001 From: Georgefifth Date: Mon, 24 Aug 2026 09:18:43 +0800 Subject: [PATCH 3/3] Fix Cython 3.3.0 compiler crash when compiling the WebSocket reader (#13521) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What do these changes do? Problem: building aiohttp with Cython 3.3.0 crashes in `AnalyseDeclarationsTransform` while compiling the WebSocket reader (`make cythonize` / `python -m cython -3 --module-name aiohttp._websocket.reader_c aiohttp/_websocket/reader_py.py`). The crash is a `NoneType` annotation type in Cython's `_analyse_target_declaration`, triggered by `ALLOWED_CLOSE_CODES: Final[set[int]] = {...}` while the same name is declared `cdef set` in `reader_c.pxd`. Solution: drop the `Final` wrapper from that module-level annotation (a bare `set[int]` annotation compiles fine under both Cython 3.2.9 and 3.3.0, verified in isolation) and remove the now-unused `Final` import. With the crash gone, Cython 3.3.0 also rejects `start_pos: int = 0` in `WebSocketReader._feed_data` as a redeclaration of the `start_pos=Py_ssize_t` local from `reader_c.pxd`, so that annotation is dropped too — the `.pxd` declaration already provides the Cython type and pure-Python behavior is unchanged. Result: `reader_c.c` regenerates cleanly with both Cython 3.3.0 (previously: compiler crash) and Cython 3.2.9 (the pinned version, so no regression for current builds), using the exact command from the Makefile. WebSocket test suites pass with the pure-Python reader: `tests/test_websocket_parser.py` + `test_websocket_data_queue.py` (95 passed, 2 skipped) and `test_websocket_writer.py` + `test_web_websocket.py` (92 passed). ## Are there changes in behavior for the user? No runtime behavior change. `Final` is only a type-checker hint, and the removed local annotation changes nothing in pure-Python mode; the generated Cython code still gets `start_pos` typed as `Py_ssize_t` from the `.pxd`. ## Is it a substantial burden for the maintainers to support this? No — three lines removed, no new code paths. It just keeps the existing source compatible with newer Cython releases. ## Related issue number Fixes #13520 ## Checklist - [x] I think the code is well written - [ ] Unit tests for the changes exist - [ ] Documentation reflects the changes - [x] If you provide code modification, please add yourself to `CONTRIBUTORS.txt` * The format is <Name> <Surname>. * Please keep alphabetical order, the file is sorted by names. - [x] Add a new news fragment into the `CHANGES/` folder * name it `..rst` (e.g. `588.bugfix.rst`) * if you don't have an issue number, change it to the pull request number after creating the PR * `.bugfix`: A bug fix for something the maintainers deemed an improper undesired behavior that got corrected to match pre-agreed expectations. --- CHANGES/13520.bugfix.rst | 5 +++++ CONTRIBUTORS.txt | 1 + aiohttp/_websocket/reader_py.py | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 CHANGES/13520.bugfix.rst diff --git a/CHANGES/13520.bugfix.rst b/CHANGES/13520.bugfix.rst new file mode 100644 index 00000000000..61d59dc2fee --- /dev/null +++ b/CHANGES/13520.bugfix.rst @@ -0,0 +1,5 @@ +Fixed Cython 3.3.0 failing to compile the WebSocket reader: dropped the +``Final[...]`` annotation from ``ALLOWED_CLOSE_CODES`` and the ``int`` +annotation from the local ``start_pos`` in ``WebSocketReader._feed_data``, +both of which conflicted with declarations in ``reader_c.pxd`` under +Cython 3.3.0 -- by :user:`Georgefifth`. diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index d843e49b5f9..e4946d9b76d 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -155,6 +155,7 @@ Gary Leung Gary Wilson Jr. Gene Hoffman Gennady Andreyev +George Fifth Georges Dubus goingforstudying-ctrl Greg Holt diff --git a/aiohttp/_websocket/reader_py.py b/aiohttp/_websocket/reader_py.py index b22884cec62..a295db0a4a7 100644 --- a/aiohttp/_websocket/reader_py.py +++ b/aiohttp/_websocket/reader_py.py @@ -4,7 +4,6 @@ import builtins import sys from collections import deque -from typing import Final from ..base_protocol import BaseProtocol from ..compression_utils import TooManyMembersError, ZLibDecompressor @@ -25,7 +24,7 @@ WSMsgType, ) -ALLOWED_CLOSE_CODES: Final[set[int]] = {int(i) for i in WSCloseCode} +ALLOWED_CLOSE_CODES: set[int] = {int(i) for i in WSCloseCode} # States for the reader, used to parse the WebSocket frame # integer values are used so they can be cythonized @@ -353,7 +352,7 @@ def _feed_data(self, data: bytes) -> None: if self._tail: data, self._tail = self._tail + data, b"" - start_pos: int = 0 + start_pos = 0 data_len = len(data) data_cstr = data