Translucent persistent objects
Project description
persistent: automatic persistence for Python objects
This 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 (http://persistent.readthedocs.io/en/latest/) or stable release (http://persistent.readthedocs.io/en/stable/).
persistent Changelog
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 raises ValueError instead of AssertionError for certain types of bad inputs.
The Python implementation uses the C wording for error messages.
The C implementation properly implements IPickleCache; methods unique to the Python implementation were moved to IExtendedPickleCache.
The Python implementation raises AttributeError if a persistent class doesn’t have a p_jar attribute.
See issue 102.
Allow sweeping cache without cache_size. cache_size_bytes works with cache_size=0, no need to set cache_size to a large value.
Require CFFI on CPython for pure-Python operation. This drops support for Jython (which was untested). See issue 77.
Fix DeprecationWarning about PY_SSIZE_T_CLEAN. See issue 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. See issue 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. See issue 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 -fwrapv is not enabled. See issue 86.
4.4.1 (2018-08-23)
Fix installation of source packages on PyPy. See issue 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. See issue 86.
Change the default representation of Persistent objects 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. See issue 11.
Reach and maintain 100% test coverage.
Simplify __init__.py, including removal of an attempted legacy import of persistent.TimeStamp. See PR 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 time when CFFI is available. This replaces the deprecated way of building them at import time. If binary wheels are distributed, it eliminates the need to have a functioning C compiler to use PyPy. See issue 75.
Fix deleting the _p_oid of 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. See PR 82.
Make the return value of TimeStamp.second() consistent across C and Python implementations when the TimeStamp was created from 6 arguments with floating point seconds. Also make it match across trips through TimeStamp.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. See issue 41.
4.3.0 (2018-07-30)
Fix the possibility of a rare crash in the C extension when deallocating items. See https://github.com/zopefoundation/persistent/issues/66
Change cPickleCache’s comparison of object sizes to determine whether an object can go in the cache to use PyObject_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 include cPersistent_HEAD and not set tp_base to cPersistenceCAPI->pertype and still be eligible for the pickle cache; that is no longer the case. See issue 69.
4.2.4.2 (2017-04-23)
Packaging-only release: fix Python 2.7 manylinux wheels.
4.2.4.1 (2017-04-21)
Packaging-only release: get manylinux wheel built automatically.
4.2.4 (2017-03-20)
Avoid raising a SystemError: error return without exception set when loading an object with slots whose jar generates an exception (such as a ZODB POSKeyError) in setstate.
4.2.3 (2017-03-08)
Fix the hashcode of Python TimeStamp objects on 64-bit Python on Windows. See https://github.com/zopefoundation/persistent/pull/55
Stop calling gc.collect every time PickleCache.incrgc is 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 to PickleCache.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 when state parameter is not a built-in dict
4.2.2 (2016-11-29)
Drop use of ctypes for determining maximum integer size, to increase pure-Python compatibility. See https://github.com/zopefoundation/persistent/pull/31
Ensure that __slots__ attributes are cleared when a persistent object is ghostified. (This excluses classes that override __new__. See https://github.com/zopefoundation/persistent/wiki/Notes_on_state_new_and_slots if you’re curious.)
4.2.1 (2016-05-26)
Fix the hashcode of C TimeStamp objects on 64-bit Python 3 on Windows.
4.2.0 (2016-05-05)
Fixed the Python(/PYPY) implementation TimeStamp.timeTime method to have subsecond precision.
When testing PURE_PYTHON environments under tox, 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 of Persistent and PickleCache behave 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 Python TimeStamp on 32-bit platforms.
4.0.9 (2015-04-08)
Make the C and Python TimeStamp objects behave more alike. The Python version now produces the same repr and .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-Python Persistent, avoid loading state in _p_activate for non-ghost objects (which could corrupt their state). (PR #9)
In pure-Python, and don’t throw POSKeyError if _p_activate is called on an object that has never been committed. (PR #9)
In pure-Python Persistent, avoid calling a subclass’s __setattr__ at instance creation time. (PR #8)
Make it possible to delete _p_jar / _p_oid of a pure-Python Persistent object 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 in Persistent.__setstate__ when the state dict contains exactly two keys. (PR #5)
Fix a hang in picklecache invalidation if OIDs are manually passed out-of-order. (PR #4)
Add PURE_PYTHON environment 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_size propety didn’t support deletion.
Simplified implementation of the _p_estimated_size property 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 _timestamp extension.
4.0.1 (2012-08-26)
Worked around test failure due to overflow to long on 32-bit systems.
Renamed TimeStamp extension module to avoid clash with pure-Python timestamp module on case-insensitive filesystems.
N.B: the canonical way to import the TimeStamp class is now:
from persistent.timestamp import TimeStamp
which 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 Changes
Added 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 Changes
100% unit test coverage.
Removed all ZODB-dependent tests:
Rewrote some to avoid the dependency
Cloned the remainder into new ZODB.tests modules.
Refactored some doctests refactored as unittests.
Completed pure-Python reference implementations of ‘Persistent’, ‘PickleCache’, and ‘TimeStamp’.
All covered platforms tested under tox.
Added support for continuous integration using tox and jenkins.
Added setup.py dev alias (installs nose and coverage).
Dropped dependency on zope.testing / zope.testrunner: tests now run with setup.py test.
Documentation Changes
Refactored many Doctests as Sphinx documentation (snippets are exercised via ‘tox’).
Added setup.py docs alias (installs Sphinx and repoze.sphinx.autointerface).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for persistent-4.5.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a1ea887f77b1d3eaf382a7316dd4c49956852af25eaf588f4e77567c78029b3 |
|
MD5 | afd5e7bbf0fcbaeeefe8bcdb9015225f |
|
BLAKE2b-256 | e777bb1733732c6cd1688c4a4e6560c74484c0ce249fae33afb3e639d310ed9f |
Hashes for persistent-4.5.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 009e0ff014f142419d19f97b1b89fa05e98e6e75a826e6962f6f664381b757e7 |
|
MD5 | f94cf11b69fac1a24b99e14717c3d2aa |
|
BLAKE2b-256 | 476396b8cc3b4d25b80323c79ccbe2f77a929224f94bb6d858f9b25a64fd5a27 |
Hashes for persistent-4.5.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e73c542e2e909cdecf8dcb764e1a275bdf9b71473c9307b38dbc7367d63eff4 |
|
MD5 | 884b5849701809c7f2048a639027f374 |
|
BLAKE2b-256 | 3835073411a6f98f4aba8f6ad850d75a9435f1af3a049c7daf88584a85784265 |
Hashes for persistent-4.5.0-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ea0cf67a7aa3b480d7f0530520ad85c5b1c536358b851f1c6c3bda053498652 |
|
MD5 | 7cc7c5ac80a6dcdc0a94c0c8bca3eb79 |
|
BLAKE2b-256 | ba8222ef5a3734f59ea1c448c9e81999b3d7ac0610ea4b37f6160351ced9ca15 |
Hashes for persistent-4.5.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77ede36608bb2da32dcf09e10d38095f91182e470f272fe58b6ab7dcaf8d61c1 |
|
MD5 | e353a303143faebbb29e14fee2eff414 |
|
BLAKE2b-256 | 0385608296b7f1e231fbabab4247bfc01f6f92e8b003c3f6a1ae98918d87b27b |
Hashes for persistent-4.5.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | feb7f5af3a3f347cfd61c58fff60a98c75f06c025479a2eb6bb14217d3dcbd15 |
|
MD5 | 3638f013534d53e56d55b5d0ab48e665 |
|
BLAKE2b-256 | 45e591c480fc9381ff68d9fdf8fba51dae7c8acf6344789fd07d5215d6e26a91 |
Hashes for persistent-4.5.0-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5913247c57c618e7fd4863880f9109ce3007d86129385ab491db36ff36527b9 |
|
MD5 | db77922a6f1faade461423eee53d46d3 |
|
BLAKE2b-256 | 7a392e6b46f62ef237ac39fca706bb1d88c6c0bdae2aa8220c10ba3ca92553ae |
Hashes for persistent-4.5.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30b31f566cca8506474519bd57edfe107aee82755b1670a8591855741770a04a |
|
MD5 | fcc75ceddd351fce8b5428c3421db1a4 |
|
BLAKE2b-256 | 4f0174e222327af009f5cf511b90da6ea95f81c0389a2bcf0e2a72adca6bff00 |
Hashes for persistent-4.5.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c9558739becdb92a7c0f552860c310ac6796f056187d5820818946e89be67fc |
|
MD5 | 9c4df49b3890712eac0da7ab68ea656b |
|
BLAKE2b-256 | 6765cc15185db15ad8f61f714a24b03bb56079ecd4017f87e37e5f07f1c4ff09 |
Hashes for persistent-4.5.0-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74cb10813ba5fd3f5b811d4943f9e3c9916886bf2fc60e037b826ddaea8c4c97 |
|
MD5 | a83afc3e3df88c2bd6bb994e0c007d11 |
|
BLAKE2b-256 | dbd93ae3a35d38f6af10b2d57167870202b49ba5f31fc7f74784e656334e48d9 |
Hashes for persistent-4.5.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd7c09377b1bf3a8535e43609a06a930a13b800a7c0198e9aa21296e55f57a9b |
|
MD5 | 0b0b7e9e893e5cb0b469ab670766b075 |
|
BLAKE2b-256 | ceebbc16382389835c9a1f8bb150bb11105e4db83092785ae79fa0ae263ad56c |
Hashes for persistent-4.5.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2229c323768d320aac2f1a0fe115e9ac9cea75ff2bebd52527bae2fc70227225 |
|
MD5 | 42aa042362a8bd98d7410064d6696b63 |
|
BLAKE2b-256 | eaa3ec1bc7d028a63fb97c7d71d73e09c1c0e6ad765dc14860ff59b417c88201 |
Hashes for persistent-4.5.0-cp27-cp27m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a5d676e3d090161487c0f9c1c2cdcfb45236b3d09ec586c035169ae60ee9278 |
|
MD5 | 1271cebb71cd2cdd8ec61d3074631e03 |
|
BLAKE2b-256 | d91eea88c4674673cde0ae2d0781d6e7d465811685f2de723a88acd70b914866 |