[Checkins] [zopefoundation/persistent] c4116a: new_ghost doesn't clear object state, preserving _...
GitHub
noreply at github.com
Fri Oct 28 19:29:21 CEST 2016
Branch: refs/heads/new_ghost_doesnt_clear_newargs
Home: https://github.com/zopefoundation/persistent
Commit: c4116ac1345b3ae690590b4455e927c3ae3728ad
https://github.com/zopefoundation/persistent/commit/c4116ac1345b3ae690590b4455e927c3ae3728ad
Author: Jason Madden <jamadden at gmail.com>
Date: 2016-10-28 (Fri, 28 Oct 2016)
Changed paths:
M persistent/persistence.py
M persistent/picklecache.py
Log Message:
-----------
new_ghost doesn't clear object state, preserving __getnewargs__ values.
Commit: ac51dff1512477b4afa5a7f760327730a198053d
https://github.com/zopefoundation/persistent/commit/ac51dff1512477b4afa5a7f760327730a198053d
Author: Kirill Smelkov <kirr at nexedi.com>
Date: 2016-10-28 (Fri, 28 Oct 2016)
Changed paths:
M persistent/persistence.py
M persistent/tests/test_persistence.py
Log Message:
-----------
py/deactivate vs slots: A slot variable could not be initialized at all
fe2219f4 (On deactivate release in-slots objects too) started to release
objects from slotted variables but was not careful enough while doing so: we
have to be careful while deleting as for unset variables it will raise
AttributeError:
class C(object):
__slots__ = ['aaa', 'unset']
def __init__(self, aaa):
self.aaa = 1
c = C(111)
del c.aaa
del c.unset
Traceback (most recent call last):
File "y.py", line 9, in <module>
del c.unset
AttributeError: unset
Caught by preparing fix for https://github.com/zopefoundation/persistent/pull/44#issuecomment-256768600
C version already have this protection in the original fe2219f4 patch:
+ if (PyObject_GenericSetAttr((PyObject *)self, name, NULL) < 0)
+ /* delattr of non-set slot will raise AttributeError - we
+ * simply ignore. */
+ PyErr_Clear();
Commit: 7fb761e0a86ad56f2b7dfe4c244c19fd6535a61c
https://github.com/zopefoundation/persistent/commit/7fb761e0a86ad56f2b7dfe4c244c19fd6535a61c
Author: Jason Madden <jamadden at gmail.com>
Date: 2016-10-28 (Fri, 28 Oct 2016)
Changed paths:
M persistent/persistence.py
M persistent/picklecache.py
M persistent/tests/test_persistence.py
M persistent/tests/test_picklecache.py
Log Message:
-----------
Don't clear the slots/dict when adding a new_ghost to Python
PickleCache.
Fixes #49.
Unfortunately, this doesn't fix the whole problem, because
_p_deactivate() still clears them, and so we lose what we set in __new__.
Compare: https://github.com/zopefoundation/persistent/compare/c4116ac1345b^...7fb761e0a86a
More information about the checkins
mailing list