8000 gh-133885: Use locks instead of critical sections for _zstd by emmatyping · Pull Request #134289 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-133885: Use locks instead of critical sections for _zstd #134289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Move lock check in dealloc to an assert
  • Loading branch information
emmatyping committed May 20, 2025
commit d8854c53a2ef11b73b96748f34124f5d93ea0d22
4 changes: 1 addition & 3 deletions Modules/_zstd/compressor.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,7 @@ ZstdCompressor_dealloc(PyObject *ob)
ZSTD_freeCCtx(self->cctx);
}

if (PyMutex_IsLocked(&self->lock)) {
PyMutex_Unlock(&self->lock);
}
assert(!PyMutex_IsLocked(&self->lock));

/* Py_XDECREF the dict after free the compression context */
Py_CLEAR(self->dict);
Expand Down
4 changes: 1 addition & 3 deletions Modules/_zstd/decompressor.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,7 @@ ZstdDecompressor_dealloc(PyObject *ob)
ZSTD_freeDCtx(self->dctx);
}

if (PyMutex_IsLocked(&self->lock)) {
PyMutex_Unlock(&self->lock);
}
assert(!PyMutex_IsLocked(&self->lock));

/* Py_CLEAR the dict after free decompression context */
Py_CLEAR(self->dict);
Expand Down
Loading
0