Skip to content

Commit d8854c5

Browse files
committed
Move lock check in dealloc to an assert
1 parent f6602f4 commit d8854c5

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Modules/_zstd/compressor.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ ZstdCompressor_dealloc(PyObject *ob)
402402
ZSTD_freeCCtx(self->cctx);
403403
}
404404

405-
if (PyMutex_IsLocked(&self->lock)) {
406-
PyMutex_Unlock(&self->lock);
407-
}
405+
assert(!PyMutex_IsLocked(&self->lock));
408406

409407
/* Py_XDECREF the dict after free the compression context */
410408
Py_CLEAR(self->dict);

Modules/_zstd/decompressor.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,7 @@ ZstdDecompressor_dealloc(PyObject *ob)
602602
ZSTD_freeDCtx(self->dctx);
603603
}
604604

605-
if (PyMutex_IsLocked(&self->lock)) {
606-
PyMutex_Unlock(&self->lock);
607-
}
605+
assert(!PyMutex_IsLocked(&self->lock));
608606

609607
/* Py_CLEAR the dict after free decompression context */
610608
Py_CLEAR(self->dict);

0 commit comments

Comments
 (0)