indygreg / python-zstandard

Python bindings to the Zstandard (zstd) compression library
BSD 3-Clause "New" or "Revised" License
499 stars 86 forks source link

Does the implementation release GIL? #208

Closed yuri-kilochek closed 10 months ago

yuri-kilochek commented 10 months ago

Specifically, I want to dispatch calls to ZstdCompressor.compress/ZstdDecomrpessor.decompress onto a thread pool from async code to not block the event loop. The internal multithreading support isn't helpful for this use case.

indygreg commented 10 months ago

Yes, the GIL should be released for all compression/decompression APIs. You can audit the source code to confirm. e.g. https://github.com/indygreg/python-zstandard/blob/1dc0596ccce5a3e84467183b35aaab96e445a047/c-ext/compressor.c#L549