[Checkins] SVN: ZODB/branches/jim-readCurrent/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
Wed Sep 1 18:03:46 EDT 2010


Log message for revision 116112:
  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/branches/jim-readCurrent/src/persistent/tests/test_list.py

-=-
Modified: ZODB/branches/jim-readCurrent/src/persistent/tests/test_list.py
===================================================================
--- ZODB/branches/jim-readCurrent/src/persistent/tests/test_list.py	2010-09-01 22:03:44 UTC (rev 116111)
+++ ZODB/branches/jim-readCurrent/src/persistent/tests/test_list.py	2010-09-01 22:03:46 UTC (rev 116112)
@@ -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 checkins mailing list