[Zodb-checkins] CVS: Zope/lib/python/ZODB - FileStorage.py:1.76.16.4

Chris McDonough chrism@zope.com
Mon, 6 May 2002 19:22:35 -0400


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv14356

Modified Files:
      Tag: Zope-2_5-branch
	FileStorage.py 
Log Message:
If there was an "empty" transaction (one that did not modify any
objects), read_index would fail when trying to get the max of the
nonexistent oids in the transaction.


=== Zope/lib/python/ZODB/FileStorage.py 1.76.16.3 => 1.76.16.4 ===
         pos=pos+8
 
-        _maxoid = max(tindex.keys()) # in 2.2, just max(tindex)
-        maxoid = max(_maxoid, maxoid)
-        index.update(tindex)
-
-        tindex.clear()
+        if tindex: # avoid the pathological empty transaction case
+            _maxoid = max(tindex.keys()) # in 2.2, just max(tindex)
+            maxoid = max(_maxoid, maxoid)
+            index.update(tindex)
+            tindex.clear()
 
     return pos, maxoid, ltid