mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Support for free-threaded Python #530
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lysnikolaou on GitHub (Jan 10, 2025).
Hi everyone! 👋
I'm opening an issue first of all to ask whether there's somebody that's already working on free-threading support. If not, I would like to help as much as I can. The steps are roughly the following:
PyUnstable_Module_SetGIL@lysnikolaou commented on GitHub (Jan 13, 2025):
I've looked a bit deeper into this and it looks like there's no global state n the Python side that we need to lock around. However, it should be mentioned that
Compressor,Decompressorinstances cannot be shared across threads because of #501. There's two options we could go with here:PyObject-specificPyMutexfor that and it should work okay. I can look into that if people think that's the best option.@lysnikolaou commented on GitHub (Jan 16, 2025):
A third option that was pointed out to me by @ngoldbaum, which is what python-zstandard does as well, is to add an atomic flag to the Python-level object that signifies that the compressor/decompressor instance is in use by a thread, and then raise an error if another thread tries to use it as well.
@ngoldbaum commented on GitHub (Jan 16, 2025):
Not quite, there's only an open PR. We're still waiting to hear back from the python-zstandard maintainer. Which reminds me, I should give them a ping...
@lysnikolaou commented on GitHub (Jan 16, 2025):
Right! That's what I meant to say. Thanks!
@laggron42 commented on GitHub (Sep 30, 2025):
Hi! With 3.14 around the corner and full support for free-threaded, is there news on this?
@eustas commented on GitHub (Sep 30, 2025):
Latest revision should be thread-safe. Soon we will land multi-phase initialization.
@eustas commented on GitHub (Oct 1, 2025):
Let's postpone this untill 1.2.0 released. Right after release I'm going to drop Py support below 3.6, thus we could start growing ifdefs anew.
@Dhairya3391 commented on GitHub (Oct 31, 2025):
Hey, since 1.2 is out now, any update on free-threaded Python support? I was experimenting with it locally on 3.14 and made a few small changes to get it working, but it broke... probably because I’m still figuring out how it behaves with the new free-threaded build. Just curious if this is planned soon.
@cclauss commented on GitHub (Nov 4, 2025):
A rapid local demonstration that
import brotlireenables the GIL on free-threaded Python 3.14t.%
uvx --with=brotli python3.14t -c "import brotli"@ngoldbaum commented on GitHub (Nov 12, 2025):
x-ref https://github.com/google/brotli/pull/1386, which will hopefully close this