Skip to content

Commit 48c83ed

Browse files
committed
Lift critical section to avoid clang warning
1 parent a434045 commit 48c83ed

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Modules/_zstd/decompressor.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,6 @@ stream_decompress(ZstdDecompressor *self, Py_buffer *data, Py_ssize_t max_length
402402
PyObject *ret = NULL;
403403
int use_input_buffer;
404404

405-
/* Thread-safe code */
406-
Py_BEGIN_CRITICAL_SECTION(self);
407-
408405
if (type == TYPE_DECOMPRESSOR) {
409406
/* Check .eof flag */
410407
if (self->eof) {
@@ -590,7 +587,6 @@ stream_decompress(ZstdDecompressor *self, Py_buffer *data, Py_ssize_t max_length
590587

591588
Py_CLEAR(ret);
592589
success:
593-
Py_END_CRITICAL_SECTION();
594590

595591
return ret;
596592
}
@@ -787,7 +783,13 @@ _zstd_ZstdDecompressor_decompress_impl(ZstdDecompressor *self,
787783
Py_ssize_t max_length)
788784
/*[clinic end generated code: output=a4302b3c940dbec6 input=16423de8f1c25985]*/
789785
{
790-
return stream_decompress(self, data, max_length, TYPE_DECOMPRESSOR);
786+
PyObject *ret;
787+
/* Thread-safe code */
788+
Py_BEGIN_CRITICAL_SECTION(self);
789+
790+
ret = stream_decompress(self, data, max_length, TYPE_DECOMPRESSOR);
791+
Py_END_CRITICAL_SECTION();
792+
return ret;
791793
}
792794

793795
#define clinic_state() (get_zstd_state(type))

0 commit comments

Comments
 (0)