[Zodb-checkins] SVN: ZODB/branches/tseaver-python_picklecache-2/src/persistent/ Don't return _p_ or _v_ attrs from __getstate__ .
Tres Seaver
tseaver at palladion.com
Wed Feb 16 00:04:42 EST 2011
Log message for revision 120372:
Don't return _p_ or _v_ attrs from __getstate__ .
Changed:
U ZODB/branches/tseaver-python_picklecache-2/src/persistent/pyPersistence.py
U ZODB/branches/tseaver-python_picklecache-2/src/persistent/tests/test_pyPersistence.py
-=-
Modified: ZODB/branches/tseaver-python_picklecache-2/src/persistent/pyPersistence.py
===================================================================
--- ZODB/branches/tseaver-python_picklecache-2/src/persistent/pyPersistence.py 2011-02-16 05:04:40 UTC (rev 120371)
+++ ZODB/branches/tseaver-python_picklecache-2/src/persistent/pyPersistence.py 2011-02-16 05:04:42 UTC (rev 120372)
@@ -274,7 +274,9 @@
"""
idict = getattr(self, '__dict__', None)
if idict is not None:
- return idict
+ return dict([x for x in idict.items()
+ if not x[0].startswith('_p_') and
+ not x[0].startswith('_v_')])
return ()
def __setstate__(self, state):
Modified: ZODB/branches/tseaver-python_picklecache-2/src/persistent/tests/test_pyPersistence.py
===================================================================
--- ZODB/branches/tseaver-python_picklecache-2/src/persistent/tests/test_pyPersistence.py 2011-02-16 05:04:40 UTC (rev 120371)
+++ ZODB/branches/tseaver-python_picklecache-2/src/persistent/tests/test_pyPersistence.py 2011-02-16 05:04:42 UTC (rev 120372)
@@ -670,6 +670,8 @@
pass
inst = Derived()
inst.foo = 'bar'
+ inst._p_baz = 'bam'
+ inst._v_qux = 'spam'
self.assertEqual(inst.__getstate__(), {'foo': 'bar'})
def test___setstate___empty(self):
More information about the Zodb-checkins
mailing list