Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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',
Expand Down
25 changes: 0 additions & 25 deletions src/persistent/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
##############################################################################

"""Python implementation of persistent list."""
import sys
from collections import UserList

import persistent
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/persistent/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/persistent/tests/test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 1 addition & 4 deletions src/persistent/tests/test_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/persistent/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading