markupsafe: Unicode incorrectly escaped on PyPy 7.3.1

On PyPy (specifically, the wheel with _speedups.pypy36-pp73-x86_64-linux-gnu.so), when using markupsafe.escape(), this unicode below is incorrectly escaped;

Input: 'https://x?<ab c>&q"+%3D%2B"="fö%26=o"'

_native: 'https://x?&lt;ab c&gt;&amp;q&#34;+%3D%2B&#34;=&#34;fö%26=o&#34;' _speedups (on pypy): 'https://x?&lt;ab c&gt;&amp;q&#34;+%3D%2B&#34;=&#34;fö%26=o'

This was caught while testing PyPy support for synapse, in https://github.com/matrix-org/synapse/pull/9123, in which one of the tests hooked behind here.

I am no expert in C, but I have a feeling one of the Unicode APIs used in _speedups.c is either being used incorrectly, or has an implementation mismatch compared to cPython

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (13 by maintainers)

Most upvoted comments

OK, I deleted the 1.1.1 pp36 and pp37 wheels, PyPy users will have to install from the sdist until 2.0 (which was the case anyway). I’ll disable building the extension during cibuildwheel later, leaving this issue open for that. I don’t think I’ll be able to mark just the PyPy wheels “pure Python”, so future versions will still have platform tags even though they don’t have the C extension and are equivalent.