Python 3.10 - PY_SSIZE_T_CLEAN macro must be defined for '#' formats

See original GitHub issue

Describe the bug Python 3.10 seems to introduce the following error PY_SSIZE_T_CLEAN macro must be defined for '#' formats

To Reproduce Steps to reproduce the behavior:

  1. Integrate with django
  2. Use python 3.10
  3. Turn on logging and try to connect

Expected behavior A successful websocket connection

Logs

trunk-player_1         | kSic9yN6dPgg5MZHAAAC: Sending packet OPEN data {'sid': 'kSic9yN6dPgg5MZHAAAC', 'upgrades': [], 'pingTimeout': 20000, 'pingInterval': 25000}
trunk-player_1         | INFO:engineio.server:kSic9yN6dPgg5MZHAAAC: Sending packet OPEN data {'sid': 'kSic9yN6dPgg5MZHAAAC', 'upgrades': [], 'pingTimeout': 20000, 'pingInterval': 25000}
trunk-player_1         | kSic9yN6dPgg5MZHAAAC: Received request to upgrade to websocket
trunk-player_1         | INFO:engineio.server:kSic9yN6dPgg5MZHAAAC: Received request to upgrade to websocket
trunk-player_1         | kSic9yN6dPgg5MZHAAAC: Upgrade to websocket successful
trunk-player_1         | INFO:engineio.server:kSic9yN6dPgg5MZHAAAC: Upgrade to websocket successful
trunk-player_1         | kSic9yN6dPgg5MZHAAAC: Unexpected error "PY_SSIZE_T_CLEAN macro must be defined for '#' formats", closing connection
trunk-player_1         | INFO:engineio.server:kSic9yN6dPgg5MZHAAAC: Unexpected error "PY_SSIZE_T_CLEAN macro must be defined for '#' formats", closing connection
trunk-player_1         | [pid: 1|app: 0|req: 29/28] 172.70.230.38 () {54 vars in 826 bytes} [Thu Feb  3 18:05:27 2022] GET /socket.io/?EIO=4&transport=websocket => generated 0 bytes in 4 msecs (HTTP/1.1 101) 4 headers in 164 bytes (2 switches on core 97)

Additional context Django app in Docker container w/ uwsgi

These may be relevant https://bugs.python.org/issue40943 https://www.python.org/dev/peps/pep-0353/

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
miguelgrinbergcommented, Feb 4, 2022

I think uWSGI is the culprit. See https://github.com/unbit/uwsgi/pull/2363. This was merged, but no release has been issued with this fix yet.

0reactions
MaxwellDPScommented, Feb 4, 2022

Thanks again for the help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SystemError: PY_SSIZE_T_CLEAN macro must be defined for ...
It sounds like the extension was not updated for python 3.10. ... the macro PY_SSIZE_T_CLEAN must be defined before including Python.h.
Read more >
Python 3.10: SystemError: PY_SSIZE_T_CLEAN macro must ...
"* "The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() formats which use #: es#, et#, s#, u#, y#, z#, ......
Read more >
PY_SSIZE_T_CLEAN macro must be defined for '#' formats ...
when I just use apache it is ok, but when I add postfix or dovecot it invokes the systemd modules and then I...
Read more >
1897544 – python-crypto fails to build with Python 3.10
Bug 1897544 - python-crypto fails to build with Python 3.10: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats.
Read more >
Hi all: After upgrading ecosystem to 4.0.The python is 3.10.4 ...
After upgrading ecosystem to 4.0.The python is 3.10.4,when hp-setup,the "SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats.".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found