[Zodb-checkins] SVN: ZODB/trunk/src/persistent/tests/test_list.py Python 2.6 and 2.7 ABCs have a bug that causes memory leaks when

Jim Fulton jim at zope.com
Thu Sep 2 09:55:35 EDT 2010


Log message for revision 116136:
  Python 2.6 and 2.7 ABCs have a bug that causes memory leaks when
  classes created on the fly are used with them. Unfortunately, UserList
  and thus PersistentList have ABCs.  :(  So changed an in-test-created
  class to a glbal to avoid a testing memory leak so as not to hide real
  memory leaks.
  

Changed:
  U   ZODB/trunk/src/persistent/tests/test_list.py

-=-
Modified: ZODB/trunk/src/persistent/tests/test_list.py
===================================================================
--- ZODB/trunk/src/persistent/tests/test_list.py	2010-09-02 13:55:32 UTC (rev 116135)
+++ ZODB/trunk/src/persistent/tests/test_list.py	2010-09-02 13:55:34 UTC (rev 116136)
@@ -20,6 +20,14 @@
 l1 = [0]
 l2 = [0, 1]
 
+class OtherList:
+    def __init__(self, initlist):
+        self.__data = initlist
+    def __len__(self):
+        return len(self.__data)
+    def __getitem__(self, i):
+        return self.__data[i]
+
 class TestPList(unittest.TestCase):
 
     def _getTargetClass(self):
@@ -49,13 +57,6 @@
         uu2 = pl(u2)
 
         v = pl(tuple(u))
-        class OtherList:
-            def __init__(self, initlist):
-                self.__data = initlist
-            def __len__(self):
-                return len(self.__data)
-            def __getitem__(self, i):
-                return self.__data[i]
         v0 = pl(OtherList(u0))
         vv = pl("this is also a sequence")
 



More information about the Zodb-checkins mailing list