[Zodb-checkins] CVS: ZODB3/ZODB - Transaction.py:1.49.6.2

Jeremy Hylton jeremy at zope.com
Tue Jul 8 10:52:35 EDT 2003


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv31024/ZODB

Modified Files:
      Tag: zodb33-devel-branch
	Transaction.py 
Log Message:
Avoid creating a cycle involving traceback and frame.

The frame in commit() holds on to all sorts of things, including
database connections.  By moving the sys.exc_info() call to a new
frame, we avoid creating a cycle that must be broken by GC.


=== ZODB3/ZODB/Transaction.py 1.49.6.1 => 1.49.6.2 ===
--- ZODB3/ZODB/Transaction.py:1.49.6.1	Tue Jul  1 16:57:18 2003
+++ ZODB3/ZODB/Transaction.py	Tue Jul  8 09:52:29 2003
@@ -251,23 +251,27 @@
                 else:
                     self._finish_many(jars)
             except:
-                # Ugh, we got an got an error during commit, so we
-                # have to clean up.  First save the original exception
-                # in case the cleanup process causes another
-                # exception.
-                error = sys.exc_info()
-                try:
-                    self._commit_error(objects, ncommitted, jars, subjars)
-                except:
-                    LOG('ZODB', ERROR,
-                        "A storage error occured during transaction "
-                        "abort.  This shouldn't happen.",
-                        error=sys.exc_info())
-                raise error[0], error[1], error[2]
+                self._cleanup(objects, ncommitted, jars, subjars)
         finally:
             del objects[:] # clear registered
             if not subtransaction and self._id is not None:
                 free_transaction()
+
+    def _cleanup(self, objects, ncommitted, jars, subjars):
+        # Ugh, we got an got an error during commit, so we
+        # have to clean up.  First save the original exception
+        # in case the cleanup process causes another
+        # exception.
+        error = sys.exc_info()
+        try:
+            self._commit_error(objects, ncommitted, jars, subjars)
+        except:
+            LOG("ZODB", ERROR,
+                "A storage error occured during transaction "
+                "abort.  This shouldn't happen.",
+                error=sys.exc_info())
+        raise error[0], error[1], error[2]
+        
 
     def _get_jars(self, objects, subtransaction):
         # Returns a list of jars for this transaction.




More information about the Zodb-checkins mailing list