Skip to content

Commit 604a65a

Browse files
georgthegreatindygreg
authored andcommitted
Relax libzstd version checking
1 parent 40c8a34 commit 604a65a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

c-ext/backend_c.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,16 @@ void zstd_module_init(PyObject *m) {
155155
*/
156156
PyObject *features = NULL;
157157
PyObject *feature = NULL;
158-
unsigned zstd_ver_no = ZSTD_versionNumber();
159-
unsigned our_hardcoded_version = 10507;
160-
if (ZSTD_VERSION_NUMBER != our_hardcoded_version ||
161-
zstd_ver_no != our_hardcoded_version) {
158+
unsigned zstd_version_min = 10506;
159+
// if either compile-time or runtime version of libzstd is lower than expected, abort initialization
160+
if (ZSTD_VERSION_NUMBER < zstd_version_min ||
161+
ZSTD_versionNumber() < zstd_version_min) {
162162
PyErr_Format(
163163
PyExc_ImportError,
164164
"zstd C API versions mismatch; Python bindings were not "
165165
"compiled/linked against expected zstd version (%u returned by the "
166166
"lib, %u hardcoded in zstd headers, %u hardcoded in the cext)",
167-
zstd_ver_no, ZSTD_VERSION_NUMBER, our_hardcoded_version);
167+
ZSTD_versionNumber(), ZSTD_VERSION_NUMBER, zstd_version_min);
168168
return;
169169
}
170170

0 commit comments

Comments
 (0)