Problem with package: tornado
Package name
tornado
Package version
6.5.2, 6.4.2, 6.4.1, 6.4.0, 6.3.3 and maybe earlier
PyPI URL
https://pypi.org/project/tornado/
piwheels URL
https://www.piwheels.org/project/tornado/
Python version
- [ ] Python 3.9
- [x] Python 3.11
This is for Raspberry Pi users only. If your issue does not relate to usage on Raspberry Pi using the official distro, please don't create an issue here.
yes
The project page includes links to existing issues about the package. Please check this issue doesn't already exist.
yes
Are you the project maintainer?
- [ ] I am the maintainer
More information
Websocket functionality in Tornado is broken using the provided packages for 6.4.x (and apparently earlier) under Python 3.11:
2025-09-09 10:21:38,730 - tornado.application - ERROR - Uncaught exception GET /sockjs/946/3nwumjt5/websocket (192.168.1.181)
HTTPServerRequest(protocol='http', host='octopic.lan', method='GET', uri='/sockjs/946/3nwumjt5/websocket', version='HTTP/1.1', remote_ip='192.168.1.181')
Traceback (most recent call last):
File "/opt/octopi/oprint/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
result = await result
^^^^^^^^^^^^
File "/opt/octopi/oprint/lib/python3.11/site-packages/tornado/websocket.py", line 273, in get
await self.ws_connection.accept_connection(self)
File "/opt/octopi/oprint/lib/python3.11/site-packages/tornado/websocket.py", line 863, in accept_connection
await self._accept_connection(handler)
File "/opt/octopi/oprint/lib/python3.11/site-packages/tornado/websocket.py", line 946, in _accept_connection
await self._receive_frame_loop()
File "/opt/octopi/oprint/lib/python3.11/site-packages/tornado/websocket.py", line 1102, in _receive_frame_loop
await self._receive_frame()
File "/opt/octopi/oprint/lib/python3.11/site-packages/tornado/websocket.py", line 1160, in _receive_frame
data = _websocket_mask(self._frame_mask, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
I tested the following versions:
- piwheels 6.3.3: ❌
- piwheels 6.4.0: ❌
- piwheels 6.4.1: ❌
- piwheels 6.4.2: ❌
- piwheels 6.5.0: ✅
- piwheels 6.5.1: ✅
- piwheels 6.5.2: ❌
I also tested the 6.4.2 sdist available on PyPI and that works, so this is definitely an issue with the available packages:
- pypi sdist 6.4.2: ✅
Those packages also were rebuilt on Sep 04, maybe another ABI issue like #580?
I've just noticed that 6.5.2 is also affected, however 6.5.1 is not.
~~That makes it look like all versions are affected that also have a Python 3.13/Debian trixie package available.~~ Strike that, 6.4.0 etc is also available for trixie, so that can't be it.
I've updated the original post accordingly.
I've skipped those versions. Will look into it.
I see that they are skipped for 3.11 on the page, but the available wheels get pulled in. E.g. https://www.piwheels.org/simple/tornado/tornado-6.4.2-cp38-abi3-linux_armv7l.whl is getting pulled in in this image build and causes the above error.
I've now fixed the image build by explicitly installing the sdist version, but anyone currently trying to install tornado on an RPi running Python 3.11 is going to have broken websocket support.
edit never mind, just saw things have changed. The info on the website didn't change vs previously when broken things were still being pulled in, but I see that the json was updated.
It shouldn't be, as the simple index has been rewritten without the 6.4.2 wheels.
Yeah, sorry for that, as I just edited in, I didn't see a change on the website and thus thought we just misunderstood each other (as the Python 3.11 column had a - all the time already), but on checking the index just now I saw that the versions were pulled.
Thank you very much for the fast response!