Commit 24b083e
committed
perf: add free-threaded Python (3.13t+) safety with per-object critical sections
Use Py_BEGIN_CRITICAL_SECTION / Py_END_CRITICAL_SECTION to protect
concurrent access to xxhash_state in all four hash types.
- Python >= 3.13: uses PyObject's built-in ob_mutex via critical section
- Python < 3.13: macros expand to nothing (GIL protects us)
- GIL build (3.13+): macros expand to nothing (zero overhead)
- Free-threaded build (3.13t+): real per-object locking
- Locked operations: do_update, digest, hexdigest, intdigest,
copy, reset, dealloc, init1 parent c0f71ae commit 24b083e
1 file changed
Lines changed: 97 additions & 8 deletions
0 commit comments