[Zodb-checkins] SVN: ZODB/trunk/src/ Bug fixed:

Jim Fulton jim at zope.com
Fri Sep 10 14:31:55 EDT 2010


Log message for revision 116298:
  Bug fixed:
  
  Objects added in transactions that were later aborted could have
  _p_changed still set (https://bugs.launchpad.net/zodb/+bug/615758).
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZODB/Connection.py
  U   ZODB/trunk/src/ZODB/tests/testConnection.py

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2010-09-10 18:29:06 UTC (rev 116297)
+++ ZODB/trunk/src/CHANGES.txt	2010-09-10 18:31:55 UTC (rev 116298)
@@ -18,6 +18,9 @@
 - ZEO extension methods failed when a client reconnected to a
   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)
 =====================
 

Modified: ZODB/trunk/src/ZODB/Connection.py
===================================================================
--- ZODB/trunk/src/ZODB/Connection.py	2010-09-10 18:29:06 UTC (rev 116297)
+++ ZODB/trunk/src/ZODB/Connection.py	2010-09-10 18:31:55 UTC (rev 116298)
@@ -446,6 +446,8 @@
                     del self._cache[oid]
                 del obj._p_jar
                 del obj._p_oid
+                if obj._p_changed:
+                    obj._p_changed = False
                 self._db.save_oid(oid)
             else:
 
@@ -736,6 +738,8 @@
         self._invalidate_creating()
         while self._added:
             oid, obj = self._added.popitem()
+            if obj._p_changed:
+                obj._p_changed = False
             del obj._p_oid
             del obj._p_jar
         self._tpc_cleanup()
@@ -750,6 +754,8 @@
             o = self._cache.get(oid)
             if o is not None:
                 del self._cache[oid]
+                if o._p_changed:
+                    o._p_changed = False
                 del o._p_jar
                 del o._p_oid
 

Modified: ZODB/trunk/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testConnection.py	2010-09-10 18:29:06 UTC (rev 116297)
+++ ZODB/trunk/src/ZODB/tests/testConnection.py	2010-09-10 18:31:55 UTC (rev 116298)
@@ -826,9 +826,27 @@
 
     """
 
+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):
     def setValueWithSize(self, size=0): self.value = size*' '
     __init__ = setValueWithSize



More information about the Zodb-checkins mailing list