Skip to content

[pull] master from aio-libs:master - #732

Merged
pull[bot] merged 3 commits into
tj-python:masterfrom
aio-libs:master
Aug 24, 2026
Merged

[pull] master from aio-libs:master#732
pull[bot] merged 3 commits into
tj-python:masterfrom
aio-libs:master

Conversation

@pull

@pull pull Bot commented Aug 24, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

LALITH0110 and others added 3 commits August 24, 2026 00:23
…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.
@pull pull Bot locked and limited conversation to collaborators Aug 24, 2026
@pull pull Bot added the ⤵️ pull label Aug 24, 2026
@pull
pull Bot merged commit fdebfa2 into tj-python:master Aug 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants