[Zodb-checkins] SVN: ZODB/branches/3.9/src/ Bugs Fixed

Jim Fulton jim at zope.com
Mon Sep 20 17:37:02 EDT 2010


Log message for revision 116691:
  Bugs 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/branches/3.9/src/CHANGES.txt
  U   ZODB/branches/3.9/src/ZODB/Connection.py
  U   ZODB/branches/3.9/src/ZODB/tests/testConnection.py

-=-
Modified: ZODB/branches/3.9/src/CHANGES.txt
===================================================================
--- ZODB/branches/3.9/src/CHANGES.txt	2010-09-20 21:26:47 UTC (rev 116690)
+++ ZODB/branches/3.9/src/CHANGES.txt	2010-09-20 21:37:01 UTC (rev 116691)
@@ -39,6 +39,9 @@
   The objects' _p_oid and _p_jar variables weren't cleared, leading to
   surprizing errors.
 
+- Objects added in transactions that were later aborted could have
+  _p_changed still set (https://bugs.launchpad.net/zodb/+bug/615758).
+
 - ZEO extension methods failed when a client reconnected to a
   storage. (https://bugs.launchpad.net/zodb/+bug/143344)
 

Modified: ZODB/branches/3.9/src/ZODB/Connection.py
===================================================================
--- ZODB/branches/3.9/src/ZODB/Connection.py	2010-09-20 21:26:47 UTC (rev 116690)
+++ ZODB/branches/3.9/src/ZODB/Connection.py	2010-09-20 21:37:01 UTC (rev 116691)
@@ -448,6 +448,8 @@
                     del self._cache[oid]
                 del obj._p_jar
                 del obj._p_oid
+                if obj._p_changed:
+                    obj._p_changed = False
             else:
 
                 # Note: If we invalidate a non-ghostifiable object
@@ -743,6 +745,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()
@@ -756,6 +760,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/branches/3.9/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/branches/3.9/src/ZODB/tests/testConnection.py	2010-09-20 21:26:47 UTC (rev 116690)
+++ ZODB/branches/3.9/src/ZODB/tests/testConnection.py	2010-09-20 21:37:01 UTC (rev 116691)
@@ -632,6 +632,28 @@
 
     """
 
+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('t.fs')
+>>> 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