Fix Python 3.14 compatibility issue

Removed unnecessary version check and simplified compatibility fix for Python 3.14 by directly importing ByteString from collections.abc and assigning it to typing.ByteString.
This commit is contained in:
xixu-me committed 2025-05-31 16:59:01 +08:00
1 parent 7c36b7ac34
commit e6af81c3ac
1 file changed
+6 -10
+6 -10
View File
@@ -1,19 +1,15 @@
"""tzst - A Python library for creating and manipulating .tzst/.tar.zst archives."""
import sys
# Compatibility fix for Python 3.14 - ByteString was removed from typing
# This is required for the zstandard library to work with Python 3.14+
if sys.version_info >= (3, 14):
# ByteString was removed in Python 3.14, provide compatibility for zstandard
import typing
import typing
try:
from collections.abc import ByteString
try:
from collections.abc import ByteString
typing.ByteString = ByteString
except ImportError:
pass
typing.ByteString = ByteString
except ImportError:
pass
__version__ = "0.4.0"