Browse Source

Intermediate changes
commit_hash:733d9d1dc02b26eb79eefc2059e2b9e39f7e1289

robot-piglet 2 months ago
parent
commit
8ab4ecc8f6

+ 11 - 1
contrib/python/zope.interface/py3/.dist-info/METADATA

@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: zope.interface
-Version: 7.1.1
+Version: 7.2
 Summary: Interfaces for Python
 Home-page: https://github.com/zopefoundation/zope.interface
 Author: Zope Foundation and Contributors
@@ -76,12 +76,22 @@ For detailed documentation, please see https://zopeinterface.readthedocs.io/en/l
  Changes
 =========
 
+7.2 (2024-11-28)
+================
+
+- Add preliminary support for Python 3.14a2, this means that
+  ``.common.builtins.IByteString`` and ``.common.collections.IByteString`` are
+  no longer available from this Python version onwards as Python 3.14 dropped
+  ``collections.abc.ByteString``.
+
+
 7.1.1 (2024-10-23)
 ==================
 
 - Fix segmentation faults in `weakrefobject.c` on Python 3.12 and 3.13.
   (`#323 <https://github.com/zopefoundation/zope.interface/issues/323>`_)
 
+
 7.1.0 (2024-10-10)
 ==================
 

+ 1 - 1
contrib/python/zope.interface/py3/ya.make

@@ -2,7 +2,7 @@
 
 PY3_LIBRARY()
 
-VERSION(7.1.1)
+VERSION(7.2)
 
 LICENSE(ZPL-2.1)
 

+ 3 - 0
contrib/python/zope.interface/py3/zope/interface/_compat.py

@@ -22,6 +22,9 @@ import os
 import sys
 
 
+PY313_OR_OLDER = sys.version_info < (3, 14)
+
+
 def _normalize_name(name):
     if isinstance(name, bytes):
         name = str(name, 'ascii')

+ 11 - 9
contrib/python/zope.interface/py3/zope/interface/common/builtins.py

@@ -19,6 +19,7 @@ that they implement the appropriate interface.
 """
 
 from zope.interface import classImplements
+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
@@ -67,17 +68,18 @@ class ITextString(collections.ISequence):
     extra_classes = (str,)
 
 
-class IByteString(collections.IByteString):
-    """
-    Interface for immutable byte strings.
+if PY313_OR_OLDER:
+    class IByteString(collections.IByteString):
+        """
+        Interface for immutable byte strings.
 
-    On all Python versions this is :class:`bytes`.
+        On all Python versions this is :class:`bytes`.
 
-    Unlike :class:`zope.interface.common.collections.IByteString`
-    (the parent of this interface) this does *not* include
-    :class:`bytearray`.
-    """
-    extra_classes = (bytes,)
+        Unlike :class:`zope.interface.common.collections.IByteString`
+        (the parent of this interface) this does *not* include
+        :class:`bytearray`.
+        """
+        extra_classes = (bytes,)
 
 
 class INativeString(ITextString):

+ 9 - 7
contrib/python/zope.interface/py3/zope/interface/common/collections.py

@@ -38,6 +38,7 @@ from collections import UserList
 from collections import UserString
 from collections import abc
 
+from zope.interface._compat import PY313_OR_OLDER
 from zope.interface.common import ABCInterface
 from zope.interface.common import optional
 
@@ -190,13 +191,14 @@ class IMutableSequence(ISequence):
     extra_classes = (UserList,)
 
 
-class IByteString(ISequence):
-    """
-    This unifies `bytes` and `bytearray`.
-    """
-    abc = _new_in_ver(
-        'ByteString', True, (ISequence.getABC(),), (bytes, bytearray),
-    )
+if PY313_OR_OLDER:
+    class IByteString(ISequence):
+        """
+        This unifies `bytes` and `bytearray`.
+        """
+        abc = _new_in_ver(
+            'ByteString', True, (ISequence.getABC(),), (bytes, bytearray),
+        )
 
 
 class ISet(ICollection):

+ 10 - 3
contrib/python/zope.interface/py3/zope/interface/common/tests/test_builtins.py

@@ -12,6 +12,7 @@
 
 import unittest
 
+from zope.interface._compat import PY313_OR_OLDER
 from zope.interface.common import builtins
 
 from . import VerifyClassMixin
@@ -24,16 +25,22 @@ class TestVerifyClass(VerifyClassMixin,
     pass
 
 
-add_verify_tests(TestVerifyClass, (
+VERIFY_TESTS = [
     (builtins.IList, (list,)),
     (builtins.ITuple, (tuple,)),
     (builtins.ITextString, (str,)),
-    (builtins.IByteString, (bytes,)),
     (builtins.INativeString, (str,)),
     (builtins.IBool, (bool,)),
     (builtins.IDict, (dict,)),
     (builtins.IFile, ()),
-))
+
+]
+if PY313_OR_OLDER:
+    VERIFY_TESTS.append(
+        (builtins.IByteString, (bytes,))
+    )
+
+add_verify_tests(TestVerifyClass, tuple(VERIFY_TESTS))
 
 
 class TestVerifyObject(VerifyObjectMixin,

+ 2 - 0
contrib/python/zope.interface/py3/zope/interface/interface.py

@@ -825,6 +825,8 @@ class InterfaceClass(_InterfaceClassBase):
                 # __firstlineno__: Python 3.13b1+
                 # https://github.com/python/cpython/pull/118475
                 '__firstlineno__',
+                # __classdictcell__: Python 3.14
+                '__classdictcell__',
             ) and
             aval is not _decorator_non_return  # noqa W503
         }