[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/tests/IterationTests.py Explain checkIteratorGCSpanTransactions a bit.

Christian Theune ct at gocept.com
Fri Nov 20 01:27:17 EST 2009


Log message for revision 105895:
  Explain checkIteratorGCSpanTransactions a bit.
  

Changed:
  U   ZODB/trunk/src/ZEO/tests/IterationTests.py

-=-
Modified: ZODB/trunk/src/ZEO/tests/IterationTests.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/IterationTests.py	2009-11-19 22:56:54 UTC (rev 105894)
+++ ZODB/trunk/src/ZEO/tests/IterationTests.py	2009-11-20 06:27:16 UTC (rev 105895)
@@ -45,11 +45,14 @@
         self.assertRaises(KeyError, self._storage._server.iterator_next, iid)
 
     def checkIteratorGCSpanTransactions(self):
+        # Keep a hard reference to the iterator so it won't be automatically
+        # garbage collected at the transaction boundary.
         iterator = self._storage.iterator()
         t = transaction.Transaction()
         self._storage.tpc_begin(t)
         self._storage.tpc_vote(t)
         self._storage.tpc_finish(t)
+        # As the iterator was not garbage collected, we can still use it.
         self.assertEquals([], list(iterator))
 
     def checkIteratorGCStorageCommitting(self):
@@ -100,6 +103,7 @@
         self.assertRaises(StopIteration, iter1.next)
         self.assertRaises(StopIteration, iter2.next)
 
+
 def iterator_sane_after_reconnect():
     r"""Make sure that iterators are invalidated on disconnect.
 



More information about the Zodb-checkins mailing list