diff --git a/setup.py b/setup.py index 095ea2e..96eba54 100644 --- a/setup.py +++ b/setup.py @@ -96,11 +96,11 @@ def _read_file(filename): "License :: OSI Approved :: Zope Public License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Framework :: ZODB", @@ -142,7 +142,7 @@ def _read_file(filename): 'sphinx_rtd_theme', ], }, - python_requires='>=3.9', + python_requires='>=3.10', install_requires=[ 'zope.deferredimport', 'zope.interface', diff --git a/src/persistent/list.py b/src/persistent/list.py index 40e44e1..4102ef0 100644 --- a/src/persistent/list.py +++ b/src/persistent/list.py @@ -13,7 +13,6 @@ ############################################################################## """Python implementation of persistent list.""" -import sys from collections import UserList import persistent @@ -52,30 +51,6 @@ class PersistentList(UserList, persistent.Persistent): else lambda inst: inst.__delitem__(_SLICE_ALL) ) - if sys.version_info[:3] < (3, 7, 4): # pragma: no cover - # Prior to 3.7.4, Python 3 failed to properly - # return an instance of the same class. - # See https://bugs.python.org/issue27639 - # and https://github.com/zopefoundation/persistent/issues/112. - # We only define the special method on the necessary versions to avoid - # any speed penalty. - def __getitem__(self, item): - result = self.__super_getitem(item) - if isinstance(item, slice): - result = self.__class__(result) - return result - - if sys.version_info[:3] < (3, 7, 4): # pragma: no cover - # Likewise for __copy__. - # See - # https://github.com/python/cpython/commit/3645d29a1dc2102fdb0f5f0c0129ff2295bcd768 - def __copy__(self): - inst = self.__class__.__new__(self.__class__) - inst.__dict__.update(self.__dict__) - # Create a copy and avoid triggering descriptors - inst.__dict__["data"] = self.__dict__["data"][:] - return inst - def __setitem__(self, i, item): self.__super_setitem(i, item) self._p_changed = 1 diff --git a/src/persistent/mapping.py b/src/persistent/mapping.py index 0c1b346..cb69438 100644 --- a/src/persistent/mapping.py +++ b/src/persistent/mapping.py @@ -93,8 +93,6 @@ def clear(self): # so if there was a _container it was persisted as data. We want # to preserve that, even if we won't make any modifications otherwise. needs_changed = '_container' in self.__dict__ or bool(self) - # Python 2 implements this by directly calling self.data.clear(), - # but Python 3 does so by repeatedly calling self.popitem() self.__super_clear() if needs_changed: self._p_changed = 1 diff --git a/src/persistent/tests/test_mapping.py b/src/persistent/tests/test_mapping.py index 1962576..f34218d 100644 --- a/src/persistent/tests/test_mapping.py +++ b/src/persistent/tests/test_mapping.py @@ -251,7 +251,7 @@ def test_update_keywords(self): self.assertEqual(pm, {'b': 42}) pm = self._makeOne() - # ``other`` shows up in a Python 3 signature. + # ``other`` shows up in a Python signature. pm.update(other=42) self.assertEqual(pm, {'other': 42}) pm = self._makeOne() diff --git a/src/persistent/tests/test_persistence.py b/src/persistent/tests/test_persistence.py index fa8aa3d..c1023b6 100644 --- a/src/persistent/tests/test_persistence.py +++ b/src/persistent/tests/test_persistence.py @@ -1833,10 +1833,7 @@ class TestPersistent(self._getTargetClass()): def _normalize_repr(self, r): # addresses - r = re.sub(r'at 0x[0-9a-fA-F]*', 'at 0xdeadbeef', r) - # Python 3.7 removed the trailing , in exception reprs - r = r.replace("',)", "')") - return r + return re.sub(r'at 0x[0-9a-fA-F]*', 'at 0xdeadbeef', r) def _normalized_repr(self, o): return self._normalize_repr(repr(o)) diff --git a/src/persistent/timestamp.py b/src/persistent/timestamp.py index faa9a97..ac850d4 100644 --- a/src/persistent/timestamp.py +++ b/src/persistent/timestamp.py @@ -37,7 +37,7 @@ # Make sure to overflow and wraparound just # like the C code does. from ctypes import c_long -except ImportError: # pragma: no cover +except ModuleNotFoundError: # pragma: no cover # XXX: This is broken on 64-bit windows, where # sizeof(long) != sizeof(Py_ssize_t) # sizeof(long) == 4, sizeof(Py_ssize_t) == 8