Skip to content

Commit

Permalink
- simplify version check for Python 3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Nov 27, 2024
1 parent ebb6cd9 commit 1f6009f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 27 deletions.
7 changes: 1 addition & 6 deletions src/zope/interface/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@
import sys


PY38 = (3, 8) <= sys.version_info < (3, 9)
PY39 = (3, 9) <= sys.version_info < (3, 10)
PY310 = (3, 10) <= sys.version_info < (3, 11)
PY311 = (3, 11) <= sys.version_info < (3, 12)
PY312 = (3, 12) <= sys.version_info < (3, 13)
PY313 = (3, 13) <= sys.version_info < (3, 14)
PY314_OR_GREATER = sys.version_info >= (3, 14)


def _normalize_name(name):
Expand Down
9 changes: 2 additions & 7 deletions src/zope/interface/common/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@
"""

from zope.interface import classImplements
from zope.interface._compat import PY38
from zope.interface._compat import PY39
from zope.interface._compat import PY310
from zope.interface._compat import PY311
from zope.interface._compat import PY312
from zope.interface._compat import PY313
from zope.interface._compat import PY314_OR_GREATER
from zope.interface.common import collections
from zope.interface.common import io
from zope.interface.common import numbers
Expand Down Expand Up @@ -73,7 +68,7 @@ class ITextString(collections.ISequence):
extra_classes = (str,)


if PY38 or PY39 or PY310 or PY311 or PY312 or PY313:
if not PY314_OR_GREATER:
class IByteString(collections.IByteString):
"""
Interface for immutable byte strings.
Expand Down
9 changes: 2 additions & 7 deletions src/zope/interface/common/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@
from collections import UserString
from collections import abc

from zope.interface._compat import PY38
from zope.interface._compat import PY39
from zope.interface._compat import PY310
from zope.interface._compat import PY311
from zope.interface._compat import PY312
from zope.interface._compat import PY313
from zope.interface._compat import PY314_OR_GREATER
from zope.interface.common import ABCInterface
from zope.interface.common import optional

Expand Down Expand Up @@ -196,7 +191,7 @@ class IMutableSequence(ISequence):
extra_classes = (UserList,)


if PY38 or PY39 or PY310 or PY311 or PY312 or PY313:
if not PY314_OR_GREATER:
class IByteString(ISequence):
"""
This unifies `bytes` and `bytearray`.
Expand Down
9 changes: 2 additions & 7 deletions src/zope/interface/common/tests/test_builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@

import unittest

from zope.interface._compat import PY38
from zope.interface._compat import PY39
from zope.interface._compat import PY310
from zope.interface._compat import PY311
from zope.interface._compat import PY312
from zope.interface._compat import PY313
from zope.interface._compat import PY314_OR_GREATER
from zope.interface.common import builtins

from . import VerifyClassMixin
Expand All @@ -40,7 +35,7 @@ class TestVerifyClass(VerifyClassMixin,
(builtins.IFile, ()),

]
if PY38 or PY39 or PY310 or PY311 or PY312 or PY313:
if not PY314_OR_GREATER:
VERIFY_TESTS.append(
(builtins.IByteString, (bytes,))
)
Expand Down

0 comments on commit 1f6009f

Please sign in to comment.