Latest Results
Fix Cython 3.3.0 compiler crash when compiling the WebSocket reader (#13521)
## 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 `<issue_or_pr_num>.<type>.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. Latest Branches
-9%
dependabot/pip/3.15/gunicorn-26.1.0 +34%
dependabot/github_actions/3.15/github/codeql-action-4.37.8 -5%
dependabot/pip/gunicorn-26.1.0 © 2026 CodSpeed Technology