File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ Changes
5959 and we didn't run tests on this platform.
6060* We now use `Py_REFCNT(obj) ` instead of accessing `(*obj)->ob_refcnt ` directly.
6161 This fixes a nogil / multi-threaded compile error. (#201)
62+ * We now `collections.abs.Buffer ` on Python 3.12+ instead of `typing.ByteString `,
63+ as `typing.ByteString ` was deprecated and later removed. (#238, #262)
6264
6365Backwards Compatibility Notes
6466-----------------------------
Original file line number Diff line number Diff line change 1818import io
1919import os
2020import platform
21- from typing import ByteString
21+ import sys
22+
23+ if sys .version_info >= (3 , 12 ):
24+ from collections .abc import Buffer
25+ else :
26+ from typing import ByteString as Buffer
2227
2328# Some Python implementations don't support C extensions. That's why we have
2429# a CFFI implementation in the first place. The code here import one of our
@@ -174,7 +179,7 @@ def open(
174179 return fh
175180
176181
177- def compress (data : ByteString , level : int = 3 ) -> bytes :
182+ def compress (data : Buffer , level : int = 3 ) -> bytes :
178183 """Compress source data using the zstd compression format.
179184
180185 This performs one-shot compression using basic/default compression
@@ -192,7 +197,7 @@ def compress(data: ByteString, level: int = 3) -> bytes:
192197 return cctx .compress (data )
193198
194199
195- def decompress (data : ByteString , max_output_size : int = 0 ) -> bytes :
200+ def decompress (data : Buffer , max_output_size : int = 0 ) -> bytes :
196201 """Decompress a zstd frame into its original data.
197202
198203 This performs one-shot decompression using basic/default compression
You can’t perform that action at this time.
0 commit comments