Skip to content

Commit

Permalink
Work around the removed typing.ByteString (Python 3.14+)
Browse files Browse the repository at this point in the history
  • Loading branch information
befeleme committed Feb 20, 2025
1 parent 9eb5694 commit 21f2937
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion zstandard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
import io
import os
import platform
from typing import ByteString
from typing import Union

# ByteString has been removed from typing in Python 3.14
ByteString = Union[bytes, bytearray, memoryview]

# Some Python implementations don't support C extensions. That's why we have
# a CFFI implementation in the first place. The code here import one of our
Expand Down
4 changes: 3 additions & 1 deletion zstandard/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import os
from typing import (
IO,
BinaryIO,
ByteString,
Generator,
Iterable,
List,
Expand All @@ -18,6 +17,9 @@ from typing import (
Union,
)

# ByteString has been removed from typing in Python 3.14
ByteString: Union[bytes, bytearray, memoryview]

FLUSH_BLOCK: int
FLUSH_FRAME: int

Expand Down

0 comments on commit 21f2937

Please sign in to comment.