indygreg / python-zstandard

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

Does the implementation release GIL? #208

Closed yuri-kilochek closed 1 year ago

yuri-kilochek commented 1 year 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 1 year 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