Thread safety and concurrency
mainBoth the C extension and pure Python implementations are safe for concurrent reads.
- Free-threading: The module supports Python 3.13+ free-threading. The C extension provides this on platforms with
pthreadsupport (Linux, macOS) and Windows. On other platforms, it uses GIL-based protection. - Warning: Calling
.close()while reads are currently in progress in other threads may cause exceptions in those threads.