Skip to content

Commit

Permalink
Rework version dependent code + add change log.
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac committed Nov 28, 2024
1 parent 1f6009f commit b4b4fcd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
7.1.2 (unreleased)
==================

- Add preliminary support for Python 3.14a2.
- Add preliminary support for Python 3.14a2, this means that
``.common.builtins.IByteString`` and ``.common.collections.IByteString`` are
no longer available from this version onwards as Python 3.14 dropped
``collections.abc.ByteString``.


7.1.1 (2024-10-23)
==================
Expand Down
2 changes: 1 addition & 1 deletion src/zope/interface/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import sys


PY314_OR_GREATER = sys.version_info >= (3, 14)
PY313_OR_OLDER = sys.version_info < (3, 14)


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

from zope.interface import classImplements
from zope.interface._compat import PY314_OR_GREATER
from zope.interface._compat import PY313_OR_OLDER
from zope.interface.common import collections
from zope.interface.common import io
from zope.interface.common import numbers
Expand Down Expand Up @@ -68,7 +68,7 @@ class ITextString(collections.ISequence):
extra_classes = (str,)


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

from zope.interface._compat import PY314_OR_GREATER
from zope.interface._compat import PY313_OR_OLDER
from zope.interface.common import ABCInterface
from zope.interface.common import optional

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


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

import unittest

from zope.interface._compat import PY314_OR_GREATER
from zope.interface._compat import PY313_OR_OLDER
from zope.interface.common import builtins

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

]
if not PY314_OR_GREATER:
if PY313_OR_OLDER:
VERIFY_TESTS.append(
(builtins.IByteString, (bytes,))
)
Expand Down

0 comments on commit b4b4fcd

Please sign in to comment.