Skip to content

Commit 39441fb

Browse files
committed
Relax libzstd version checking
1 parent b63f21e commit 39441fb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

c-ext/backend_c.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ void zstd_module_init(PyObject *m) {
151151
*/
152152
PyObject *features = NULL;
153153
PyObject *feature = NULL;
154-
unsigned zstd_ver_no = ZSTD_versionNumber();
155-
unsigned our_hardcoded_version = 10507;
156-
if (ZSTD_VERSION_NUMBER != our_hardcoded_version ||
157-
zstd_ver_no != our_hardcoded_version) {
154+
unsigned zstd_version_min = 10506;
155+
// if either compile-time or runtime version of libzstd is lower than expected, abort initialization
156+
if (ZSTD_VERSION_NUMBER < zstd_version_min ||
157+
ZSTD_versionNumber() < ztd_version_min) {
158158
PyErr_Format(
159159
PyExc_ImportError,
160160
"zstd C API versions mismatch; Python bindings were not "
161161
"compiled/linked against expected zstd version (%u returned by the "
162162
"lib, %u hardcoded in zstd headers, %u hardcoded in the cext)",
163-
zstd_ver_no, ZSTD_VERSION_NUMBER, our_hardcoded_version);
163+
ZSTD_versionNumber(), ZSTD_VERSION_NUMBER, zstd_version_min);
164164
return;
165165
}
166166

0 commit comments

Comments
 (0)