Package: persistent
persistent:  automatic persistence for Python objectsThis package contains a generic persistence implementation for Python. It
forms the core protocol for making objects interact “transparently” with
a database such as the ZODB.Please see the Sphinx documentation (docs/index.rst) for further
information, or view the documentation at Read The Docs, for either
the latest (https://persistent.readthedocs.io/en/latest/) or stable
release (https://persistent.readthedocs.io/en/stable/).NoteUse of this standalonepersistentrelease is not recommended or
supported with ZODB < 3.11.  ZODB 3.10 and earlier bundle their own
version of  thepersistentpackage.persistentChangelog5.2 (2024-02-16)Add preliminary support for Python 3.13a3.5.1 (2023-10-05)Add support for Python 3.12.5.0 (2023-01-09)Build Linux binary wheels for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.4.9.3 (2022-11-16)Add support for building arm64 wheels on macOS.4.9.2 (2022-11-03)Update Python 3.11 support to final release.4.9.1 (2022-09-16)Update Python 3.11 support to 3.11.0-rc1.Disable unsafe math optimizations in C code.  Seepull request 176.4.9.0 (2022-03-10)Add support for Python 3.11 (as of 3.11a5).4.8.0 (2022-03-07)Switch package to src-layout, this is a packaging only change.
(#168)Add support for Python 3.10.4.7.0 (2021-04-13)Add support for Python 3.9.Move from Travis CI to Github Actions.Supply manylinux wheels for aarch64 (ARM).Fix the pure-Python implementation to activate a ghost object
when setting its__class__and__dict__. This matches the
behaviour of the C implementation. Seeissue 155.Fix the CFFI cache implementation (used on CPython whenPURE_PYTHON=1) to not print unraisableAttributeErrorsfrom_WeakValueDictionaryduring garbage collection. Seeissue 150.Make the pure-Python implementation of the cache run a garbage
collection (gc.collect()) onfull_sweep,incrgcandminimizeifit detects that an object that was weakly
referenced has been ejected. This solves issues on PyPy with ZODB raisingConnectionStateErrorwhen there are persistentzope.interfaceutilities/adapters registered. This partly
reverts a change from release 4.2.3.4.6.4 (2020-03-26)Fix an overly specific test failure using zope.interface 5. Seeissue 144.Fix two reference leaks that could theoretically occur as the result
of obscure errors. Seeissue 143.4.6.3 (2020-03-18)Fix a crash in the test suite under a 32-bit CPython on certain
32-bit platforms. Seeissue 137. Fix byJerry James.4.6.2 (2020-03-12)Fix anAssertionErrorclearing a non-emptyPersistentMappingthat has no connection. Seeissue 139.4.6.1 (2020-03-06)Stop installing C header files on PyPy (which is what persistent before 4.6.0
used to do), fixesissue 135.4.6.0 (2020-03-05)Fix slicing ofPersistentListto always return instances of the
same class. It was broken on Python 3 prior to 3.7.4.Fix copying  ofPersistentListandPersistentMappingusingcopy.copyto also copy the underlying data object. This was
broken prior to Python 3.7.4.Update the handling of thePURE_PYTHONenvironment variable.
Now, a value of “0” requires that the C extensions be used; any other
non-empty value prevents the extensions from being used. Also, all C
extensions are required together or none of them will be used. This
prevents strange errors that arise from a mismatch of Python and C
implementations. Seeissue 131.Note that some private implementation details such as the names of
the pure-Python implementations have changed.FixPersistentListto mark itself as changed after callingclear(if needed). SeePR 115.FixPersistentMapping.updateto accept keyword arguments like
the nativeUserDict. Previously, most uses of keyword arguments
resulted inTypeError; in the undocumented and extremely
unlikely event of a single keyword argument calledbthat
happens to be a dictionary, the behaviour will change. Also adjust
the signatures ofsetdefaultandpopto match the native
version.FixPersistentList.clear,PersistentMapping.clearandPersistentMapping.popitemto no longer mark the object as
changed if it was empty.Add preliminary support for Python 3.9a3+.
Seeissue 124.Fix the Python implementation of the PickleCache to be able to store
objects that cannot be weakly referenced. Seeissue 133.Note thatctypesis required to use the Python implementation
(except on PyPy).4.5.1 (2019-11-06)Add support for Python 3.8.Update documentation to Python 3.4.5.0 (2019-05-09)Fully test the C implementation of the PickleCache, and fix
discrepancies between it and the Python implementation:The C implementation now raisesValueErrorinstead ofAssertionErrorfor certain types of bad inputs.The Python implementation uses the C wording for error messages.The C implementation properly implementsIPickleCache; methods
unique to the Python implementation were moved toIExtendedPickleCache.The Python implementation raisesAttributeErrorif a
persistent class doesn’t have ap_jarattribute.Seeissue 102.Allow sweeping cache withoutcache_size.cache_size_bytesworks withcache_size=0, no need to setcache_sizeto a
large value.RequireCFFIon CPython for pure-Python operation. This drops
support for Jython (which was untested). Seeissue 77.Fix DeprecationWarning aboutPY_SSIZE_T_CLEAN.
Seeissue 108.Drop support for Python 3.4.4.4.3 (2018-10-22)Fix the repr of the persistent objects to include the module name
when using the C extension. This matches the pure-Python behaviour
and the behaviour prior to 4.4.0. Seeissue 92.Change the repr of persistent objects to format the OID as in
integer in hexadecimal notation if it is an 8-byte byte string, as
ZODB does. This eliminates some issues in doctests. Seeissue 95.4.4.2 (2018-08-28)Explicitly use unsigned constants for packing and unpacking C
timestamps, fixing an arithmetic issue for GCC when optimizations
are enabled and-fwrapvisnotenabled. Seeissue 86.4.4.1 (2018-08-23)Fix installation of source packages on PyPy. Seeissue 88.4.4.0 (2018-08-22)Use unsigned constants when doing arithmetic on C timestamps,
possibly avoiding some overflow issues with some compilers or
compiler settings. Seeissue 86.Change the default representation ofPersistentobjects to
include the representation of their OID and jar, if set. Also add
the ability for subclasses to implement_p_repr()instead of
overriding__repr__for better exception handling. Seeissue 11.Reach and maintain 100% test coverage.Simplify__init__.py, including removal of an attempted legacy
import ofpersistent.TimeStamp. SeePR 80.Add support for Python 3.7 and drop support for Python 3.3.Build the CFFI modules (used on PyPy or when PURE_PYTHON is set)at
installation or wheel building timewhen CFFI is available. This replacesthe deprecated wayof building them at import time. If binary wheels are distributed,
it eliminates the need to have a functioning C compiler to use PyPy.
Seeissue 75.Fix deleting the_p_oidof a pure-Python persistent object when
it is in a cache.Fix deleting special (_p) attributes of a pure-Python persistent
object that overrides__delattr__and correctly calls_p_delattr.Remove some internal compatibility shims that are no longer
necessary. SeePR 82.Make the return value ofTimeStamp.second()consistent across C
and Python implementations when theTimeStampwas created from 6
arguments with floating point seconds. Also make it match across
trips throughTimeStamp.raw(). Previously, the C version could
initially have erroneous rounding and too much false precision,
while the Python version could have too much precision. The raw/repr
values have not changed. Seeissue 41.4.3.0 (2018-07-30)Fix the possibility of a rare crash in the C extension when
deallocating items. Seehttps://github.com/zopefoundation/persistent/issues/66Change cPickleCache’s comparison of object sizes to determine
whether an object can go in the cache to usePyObject_TypeCheck().
This matches what the pure Python implementation does and is a
stronger test that the object really is compatible with the cache.
Previously, an object could potentially includecPersistent_HEADandnotsettp_basetocPersistenceCAPI->pertypeand still
be eligible for the pickle cache; that is no longer the case. Seeissue 69.4.2.4.2 (2017-04-23)Packaging-only release: fix Python 2.7manylinuxwheels.4.2.4.1 (2017-04-21)Packaging-only release:  getmanylinuxwheel built automatically.4.2.4 (2017-03-20)Avoid raising aSystemError: error return without exception setwhen loading an object with slots whose jar generates an exception
(such as a ZODBPOSKeyError) insetstate.4.2.3 (2017-03-08)Fix the hashcode of PythonTimeStampobjects on 64-bit Python on
Windows. Seehttps://github.com/zopefoundation/persistent/pull/55Stop callinggc.collectevery timePickleCache.incrgcis called (every
transaction boundary) in pure-Python mode (PyPy). This means that
the reported size of the cache may be wrong (until the next GC), but
it is much faster. This should not have any observable effects for
user code.Stop clearing the dict and slots of objects added toPickleCache.new_ghost(typically these values are passed to__new__from the pickle data) in pure-Python mode (PyPy). This
matches the behaviour of the C code.Add support for Python 3.6.Fix__setstate__interning whenstateparameter is not a built-in dict4.2.2 (2016-11-29)Drop use ofctypesfor determining maximum integer size, to increase
pure-Python compatibility. Seehttps://github.com/zopefoundation/persistent/pull/31Ensure that__slots__attributes are cleared when a persistent
object is ghostified.  (This excluses classes that override__new__.  Seehttps://github.com/zopefoundation/persistent/wiki/Notes_on_state_new_and_slotsif you’re curious.)4.2.1 (2016-05-26)Fix the hashcode of CTimeStampobjects on 64-bit Python 3 on
Windows.4.2.0 (2016-05-05)Fixed the Python(/PYPY) implementationTimeStamp.timeTimemethod
to have subsecond precision.When testingPURE_PYTHONenvironments undertox, avoid poisoning
the user’s global wheel cache.Add support for Python 3.5.Drop support for Python 2.6 and 3.2.4.1.1 (2015-06-02)Fix manifest and re-upload to fix stray files included in 4.1.0.4.1.0 (2015-05-19)Make the Python implementation ofPersistentandPickleCachebehave more similarly to the C implementation. In particular, the
Python version can now run the complete ZODB and ZEO test suites.Fix the hashcode of the PythonTimeStampon 32-bit platforms.4.0.9 (2015-04-08)Make the C and PythonTimeStampobjects behave more alike. The
Python version now produces the samereprand.raw()output as
the C version, and has the same hashcode. In addition, the Python
version is now supports ordering and equality like the C version.Intern keys of object state in__setstate__to reduce memory usage
when unpickling multiple objects with the same attributes.Add support for PyPy3.100% branch coverage.4.0.8 (2014-03-20)Add support for Python 3.4.In pure-PythonPersistent, avoid loading state in_p_activatefor non-ghost objects (which could corrupt their state).  (PR #9)In pure-Python, and don’t throwPOSKeyErrorif_p_activateis
called on an object that has never been committed.  (PR #9)In pure-PythonPersistent, avoid calling a subclass’s__setattr__at instance creation time. (PR #8)Make it possible to delete_p_jar/_p_oidof a pure-PythonPersistentobject which has been removed from the jar’s cache
(fixes aborting a ZODB Connection that has added objects). (PR #7)4.0.7 (2014-02-20)Avoid a KeyError from_p_accessed()on newly-created objects under
pure-Python:  these objects may be assigned to a jar, but not yet added
to its cache.  (PR #6)Avoid a failure inPersistent.__setstate__when the state dict
contains exactly two keys.  (PR #5)Fix a hang inpicklecacheinvalidation if OIDs are manually passed
out-of-order. (PR #4)AddPURE_PYTHONenvironment variable support:  if set, the C
extensions will not be built, imported, or tested.4.0.6 (2013-01-03)Updated Trove classifiers.4.0.5 (2012-12-14)Fixed the C-extensions under Py3k (previously they compiled but were
not importable).4.0.4 (2012-12-11)Added support for Python 3.3.C extenstions now build under Python 3.2, passing the same tests as
the pure-Python reference implementation.4.0.3 (2012-11-19)Fixed: In the C implimentation, an integer was compared with a
pointer, with undefined results and a compiler warning.Fixed: the Python implementation of the_p_estimated_sizepropety
didn’t support deletion.Simplified implementation of the_p_estimated_sizeproperty to
only accept integers.  A TypeError is raised if an incorrect type is
provided.4.0.2 (2012-08-27)Correct initialization functions in renamed_timestampextension.4.0.1 (2012-08-26)Worked around test failure due to overflow to long on 32-bit systems.RenamedTimeStampextension module to avoid clash with pure-Pythontimestampmodule on case-insensitive filesystems.N.B:  the canonical way to import theTimeStampclass is now:from persistent.timestamp import TimeStampwhich will yield the class from the extension module (if available),
falling back to the pure-Python reference implementation.4.0.0 (2012-08-11)Platform ChangesAdded explicit support for Python 3.2 and PyPy.Note that the C implementations of Persistent, PickleCache, and Timestamp
are not built (yet) on these platforms.Dropped support for Python < 2.6.Testing Changes100% unit test coverage.Removed allZODB-dependent tests:Rewrote some to avoid the dependencyCloned the remainder into newZODB.testsmodules.Refactored some doctests refactored as unittests.Completed pure-Python reference implementations of ‘Persistent’,
‘PickleCache’, and ‘TimeStamp’.All covered platforms tested undertox.Added support for continuous integration usingtoxandjenkins.Addedsetup.py devalias (installsnoseandcoverage).Dropped dependency onzope.testing/zope.testrunner:  tests now
run withsetup.py test.Documentation ChangesRefactored many Doctests as Sphinx documentation (snippets are exercised
via ‘tox’).Addedsetup.py docsalias (installsSphinxandrepoze.sphinx.autointerface).