Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ One-shot functions (``xxh32_digest``, ``xxh64_hexdigest``, ``xxh3_128_digest``,
etc.) are stateless and always safe to call concurrently.

On Python 3.13+ the lock is always active. On Python 3.9-3.12 the lock is
created on the first ``update()`` of 64KB or more; smaller operations never
release the GIL, so they are serialized by the GIL itself.
created on the first ``update()`` of more than 64KB; operations of 64KB or
less never release the GIL, so they are serialized by the GIL itself.

Sharing a streaming hash object across threads is still discouraged: even
with locking, the order in which concurrent updates are applied (and hence
Expand Down
4 changes: 2 additions & 2 deletions src/_xxhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
# define XXHASH_LOCK_FIELD PyThread_type_lock lock;
# define XXHASH_LOCK_INIT(o) ((o)->lock = NULL)
# define XXHASH_LOCK_IS_ACTIVE(o) ((o)->lock != NULL)
/* Lazy allocation on first large update */
/* Lazy allocation on first update large enough to release the GIL */
# define XXHASH_LOCK_MAYBE_INIT(o, len) \
do { \
if ((o)->lock == NULL && (len) >= XXHASH_GIL_MINSIZE) { \
if ((o)->lock == NULL && (len) > XXHASH_GIL_MINSIZE) { \
(o)->lock = PyThread_allocate_lock(); \
/* fail? lock stays NULL, fall back to non-threaded code. */ \
} \
Expand Down
2 changes: 1 addition & 1 deletion xxhash/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "4.0.0.dev7"
VERSION = "4.0.0.dev8"
Loading