Commit 75d9b564 authored by Jim Fulton's avatar Jim Fulton

Fixed bug:

  Objects defining _p_deactivate methods that didn't call base methods
  weren't loaded properly. https://bugs.launchpad.net/zodb/+bug/185066
parent ccf7c775
...@@ -19,6 +19,9 @@ Bugs Fixed ...@@ -19,6 +19,9 @@ Bugs Fixed
- Calling __setstate__ on a persistent object could under certain - Calling __setstate__ on a persistent object could under certain
uncommon cause the process to crash. uncommon cause the process to crash.
- Objects defining _p_deactivate methods that didn't call base methods
weren't loaded properly. https://bugs.launchpad.net/zodb/+bug/185066
3.9.0b5 (2009-08-06) 3.9.0b5 (2009-08-06)
==================== ====================
......
...@@ -514,9 +514,9 @@ class ObjectReader: ...@@ -514,9 +514,9 @@ class ObjectReader:
obj._p_oid = oid obj._p_oid = oid
obj._p_jar = self._conn obj._p_jar = self._conn
# When an object is created, it is put in the UPTODATE # When an object is created, it is put in the UPTODATE
# state. We must explicitly deactivate it to turn it into # state. We must explicitly invalidate it to turn it into
# a ghost. # a ghost.
obj._p_changed = None obj._p_invalidate()
self._cache[oid] = obj self._cache[oid] = obj
return obj return obj
......
...@@ -663,7 +663,22 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase): ...@@ -663,7 +663,22 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
self.assert_(cache.total_estimated_size >= 0) self.assert_(cache.total_estimated_size >= 0)
class class_that_ignores_deactivate(Persistent):
def _p_deactivate(self): pass
def loading_objects_that_ignore_deactivate_bug_185066():
"""See https://bugs.launchpad.net/bugs/185066
>>> db = ZODB.tests.util.DB()
>>> conn = db.open()
>>> conn.root.c = class_that_ignores_deactivate()
>>> conn.root.c.x = 1
>>> transaction.commit()
>>> conn2 = db.open()
>>> conn2.root.c.x
1
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment