SVN: ZODB/trunk/src/ZEO/tests/IterationTests.py Explain checkIteratorGCSpanTransactions a bit.

Christian Theune <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.