pallets / markupsafe

Safely add untrusted strings to HTML/XML markup.
https://markupsafe.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
634 stars 156 forks source link

Please could `markupsafe._speedups` declare support (or lack thereof) for free-threaded Python? #460

Closed AA-Turner closed 1 month ago

AA-Turner commented 2 months ago

When testing a project downstream of markupsafe with python3.13t via deadsnakes, the following warning is emitted:

<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'markupsafe._speedups', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.

I haven't had the time to look at the source of _speedups (sorry), but please would it be possible to declare this one way or the other? I resolved this with an axe downstream by simply deleting the compiled extension in CI, but this isn't ideal!

Thanks, Adam

davidism commented 2 months ago

How? Can you point me to instructions about this or make a PR to review?

AA-Turner commented 2 months ago

I'm on mobile so please excuse the brevity -- there are guides here (https://py-free-threading.github.io/porting/#__tabbed_1_1) on porting, and also on CI testing (https://py-free-threading.github.io/ci/). The CPython docs also have a brief HOWTO (https://docs.python.org/3.14/howto/free-threading-extensions.html).

I'm unlikely to have time to make a PR until mid-September at the earliest, sorry.

A

davidism commented 2 months ago

Thanks, seems like we need to add a marker and update cibuildwheel. I won't be able to get to this soon either, unfortunately, so anyone who sees this and has time for a PR would be appreciated.