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 <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20100902135535.422E7941DF__23367.3322167762$1283435739$gmane$org@cvs.zope.org>
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")
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.