[Zope-Checkins] CVS: ZODB3/ZEO - StorageServer.py:1.95

Shane Hathaway shane@zope.com
Wed, 14 May 2003 15:48:26 -0400


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv17382

Modified Files:
	StorageServer.py 
Log Message:
Use sys._getframe() only if a transaction error occurs, optimizing
for the common case and reducing the impact of any memory leaks associated
with sys._getframe().


=== ZODB3/ZEO/StorageServer.py 1.94 => 1.95 ===
--- ZODB3/ZEO/StorageServer.py:1.94	Wed Apr 30 13:14:33 2003
+++ ZODB3/ZEO/StorageServer.py	Wed May 14 15:48:25 2003
@@ -140,14 +140,15 @@
     def _check_tid(self, tid, exc=None):
         if self.read_only:
             raise ReadOnlyError()
-        caller = sys._getframe().f_back.f_code.co_name
         if self.transaction is None:
+            caller = sys._getframe().f_back.f_code.co_name
             self.log("no current transaction: %s()" % caller, zLOG.PROBLEM)
             if exc is not None:
                 raise exc(None, tid)
             else:
                 return 0
         if self.transaction.id != tid:
+            caller = sys._getframe().f_back.f_code.co_name
             self.log("%s(%s) invalid; current transaction = %s" %
                      (caller, repr(tid), repr(self.transaction.id)),
                      zLOG.PROBLEM)