File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments