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

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


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

Modified Files:
	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.90 => 1.91 ===
         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