Commit f3d7c254 authored by Jim Fulton's avatar Jim Fulton

Bug fixed:

Objects added in transactions that were later aborted could have
_p_changed still set (https://bugs.launchpad.net/zodb/+bug/615758).
parent 7cb0ee86
...@@ -18,6 +18,9 @@ Bugs fixed ...@@ -18,6 +18,9 @@ Bugs fixed
- ZEO extension methods failed when a client reconnected to a - ZEO extension methods failed when a client reconnected to a
storage. (https://bugs.launchpad.net/zodb/+bug/143344) storage. (https://bugs.launchpad.net/zodb/+bug/143344)
- Objects added in transactions that were later aborted could have
_p_changed still set (https://bugs.launchpad.net/zodb/+bug/615758).
3.10.0b6 (2010-09-08) 3.10.0b6 (2010-09-08)
===================== =====================
......
...@@ -446,6 +446,8 @@ class Connection(ExportImport, object): ...@@ -446,6 +446,8 @@ class Connection(ExportImport, object):
del self._cache[oid] del self._cache[oid]
del obj._p_jar del obj._p_jar
del obj._p_oid del obj._p_oid
if obj._p_changed:
obj._p_changed = False
self._db.save_oid(oid) self._db.save_oid(oid)
else: else:
...@@ -736,6 +738,8 @@ class Connection(ExportImport, object): ...@@ -736,6 +738,8 @@ class Connection(ExportImport, object):
self._invalidate_creating() self._invalidate_creating()
while self._added: while self._added:
oid, obj = self._added.popitem() oid, obj = self._added.popitem()
if obj._p_changed:
obj._p_changed = False
del obj._p_oid del obj._p_oid
del obj._p_jar del obj._p_jar
self._tpc_cleanup() self._tpc_cleanup()
...@@ -750,6 +754,8 @@ class Connection(ExportImport, object): ...@@ -750,6 +754,8 @@ class Connection(ExportImport, object):
o = self._cache.get(oid) o = self._cache.get(oid)
if o is not None: if o is not None:
del self._cache[oid] del self._cache[oid]
if o._p_changed:
o._p_changed = False
del o._p_jar del o._p_jar
del o._p_oid del o._p_oid
......
...@@ -826,8 +826,26 @@ def lp9460655(): ...@@ -826,8 +826,26 @@ def lp9460655():
""" """
def lp615758_transaction_abort_Incomplete_cleanup_for_new_objects():
r"""
As the following"DocTest" demonstrates, "abort" forgets to
reset "_p_changed" for new (i.e. "added") objects.
>>> class P(Persistent): pass
...
>>> c = ZODB.connection(None)
>>> obj = P()
>>> c.add(obj)
>>> obj.x = 1
>>> obj._p_changed
True
>>> transaction.abort()
>>> obj._p_changed
False
>>> c.close()
"""
class _PlayPersistent(Persistent): class _PlayPersistent(Persistent):
def setValueWithSize(self, size=0): self.value = size*' ' def setValueWithSize(self, size=0): self.value = size*' '
......
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