Skip to content

Commit de93ee0

Browse files
committed
global: reflect upgrade of zstd to 1.5.4
An error message change resulted in a changed test. Pretty minor. Rust complained about new fields on `ZSTD_frameHeader`. So we added them. Static APIs are now prefixed by new variants of `ZSTDLIB_API`. So we strip those as well to make cffi parsing happy on non-Windows. Closes #190.
1 parent acfd93d commit de93ee0

File tree

12 files changed

+34
-23
lines changed

12 files changed

+34
-23
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ num_cpus = "1.15.0"
1818
rayon = "1.6.1"
1919

2020
[dependencies.zstd-safe]
21-
version = "=6.0.3+zstd.1.5.2"
21+
version = "6.0.4+zstd.1.5.4"
2222
features = ["experimental", "legacy", "zstdmt"]
2323

2424
[dependencies.zstd-sys]
25-
version = "=2.0.6+zstd.1.5.2"
25+
version = "2.0.7+zstd.1.5.4"
2626
features = ["experimental", "legacy", "zstdmt"]
2727

2828
[dependencies.pyo3]

c-ext/backend_c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void zstd_module_init(PyObject *m) {
152152
PyObject *features = NULL;
153153
PyObject *feature = NULL;
154154
unsigned zstd_ver_no = ZSTD_versionNumber();
155-
unsigned our_hardcoded_version = 10502;
155+
unsigned our_hardcoded_version = 10504;
156156
if (ZSTD_VERSION_NUMBER != our_hardcoded_version ||
157157
zstd_ver_no != our_hardcoded_version) {
158158
PyErr_Format(

c-ext/python-zstandard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define ZDICT_STATIC_LINKING_ONLY
1919

2020
#ifdef ZSTD_SINGLE_FILE
21-
#include <zstdlib.c>
21+
#include <zstd.c>
2222

2323
/* We use private APIs from pool.h. We can't rely on availability
2424
of this header or symbols when linking against the system libzstd.

docs/installing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ be specified via the ``ZSTD_EXTRA_COMPILER_ARGS`` environment variable. e.g.
122122
``python-zstandard`` can be sensitive about what version of ``libzstd`` it links
123123
against. For best results, point this package at the exact same version of
124124
``libzstd`` that it bundles. See the bundled ``zstd/zstd.h`` or
125-
``zstd/zstdlib.c`` for which version that is.
125+
``zstd/zstd.c`` for which version that is.
126126

127127
When linking against an external ``libzstd``, not all package features may be
128128
available. Notably, the ``multi_compress_to_buffer()`` and

docs/news.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ Other Actions Not Blocking Release
8282
0.20.0 (not yet released)
8383
=========================
8484

85+
Changes
86+
-------
87+
88+
* Bundled zstd library upgraded from 1.5.2 to 1.5.4.
89+
8590
0.19.0 (released 2022-10-29)
8691
============================
8792

make_cffi.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
HERE = os.path.abspath(os.path.dirname(__file__))
1919

2020
SOURCES = [
21-
"zstd/zstdlib.c",
21+
"zstd/zstd.c",
2222
]
2323

2424
# Headers whose preprocessed output will be fed into cdef().
@@ -101,9 +101,15 @@ def preprocess(path):
101101
l = b"#define INT_MAX 2147483647\n"
102102

103103
# ZSTDLIB_API may not be defined if we dropped zstd.h. It isn't
104-
# important so just filter it out.
105-
if l.startswith(b"ZSTDLIB_API"):
106-
l = l[len(b"ZSTDLIB_API ") :]
104+
# important so just filter it out. Ditto for ZSTDLIB_STATIC_API and
105+
# ZDICTLIB_STATIC_API.
106+
for prefix in (
107+
b"ZSTDLIB_API",
108+
b"ZSTDLIB_STATIC_API",
109+
b"ZDICTLIB_STATIC_API",
110+
):
111+
if l.startswith(prefix):
112+
l = l[len(prefix) :]
107113

108114
lines.append(l)
109115

rust-ext/src/decompressor.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ impl ZstdDecompressor {
264264
headerSize: 0,
265265
dictID: 0,
266266
checksumFlag: 0,
267+
_reserved1: 0,
268+
_reserved2: 0,
267269
};
268270
let zresult = unsafe {
269271
zstd_sys::ZSTD_getFrameHeader(

rust-ext/src/frame_parameters.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ fn get_frame_parameters(py: Python, buffer: PyBuffer<u8>) -> PyResult<Py<FramePa
8080
headerSize: 0,
8181
dictID: 0,
8282
checksumFlag: 0,
83+
_reserved1: 0,
84+
_reserved2: 0,
8385
};
8486
let zresult = unsafe {
8587
zstd_sys::ZSTD_getFrameHeader(&mut header, raw_data.as_ptr() as *const _, raw_data.len())

setup_zstd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def get_c_extension(
8080
extra_args.append("-DZSTD_MULTITHREAD")
8181
else:
8282
extra_args.append("-DZSTD_SINGLE_FILE")
83-
extra_args.append("-DZSTDLIB_VISIBILITY=")
84-
extra_args.append("-DZDICTLIB_VISIBILITY=")
85-
extra_args.append("-DZSTDERRORLIB_VISIBILITY=")
83+
extra_args.append("-DZSTDLIB_VISIBLE=")
84+
extra_args.append("-DZDICTLIB_VISIBLE=")
85+
extra_args.append("-DZSTDERRORLIB_VISIBLE=")
8686

8787
if compiler_type == "unix":
8888
extra_args.append("-fvisibility=hidden")

0 commit comments

Comments
 (0)