]> granicus.if.org Git - python/commitdiff
Plug the last 657 referenceleaks in test_bsddb3: a circular reference
authorThomas Wouters <thomas@python.org>
Sun, 12 Mar 2006 00:13:09 +0000 (00:13 +0000)
committerThomas Wouters <thomas@python.org>
Sun, 12 Mar 2006 00:13:09 +0000 (00:13 +0000)
between a TestCase instance, the database it opened (or a cursor to a
database) and a bound method as a registered database callback, and a lack
of GC-handling in bsddb caused the TestCases to linger. Fix the test, for
now, as backward compatibility makes adding GC to bsddb annoying.

Lib/bsddb/test/test_associate.py

index 0015b53941e4a3dba8a6f250f5e9993a65c09cd7..05ef83cb6fa49f5514a318c1445d6e9db5f37357 100644 (file)
@@ -105,6 +105,7 @@ class AssociateErrorTestCase(unittest.TestCase):
 
     def tearDown(self):
         self.env.close()
+        self.env = None
         import glob
         files = glob.glob(os.path.join(self.homeDir, '*'))
         for file in files:
@@ -166,6 +167,7 @@ class AssociateTestCase(unittest.TestCase):
     def tearDown(self):
         self.closeDB()
         self.env.close()
+        self.env = None
         import glob
         files = glob.glob(os.path.join(self.homeDir, '*'))
         for file in files:
@@ -192,9 +194,12 @@ class AssociateTestCase(unittest.TestCase):
     def closeDB(self):
         if self.cur:
             self.cur.close()
+            self.cur = None
         if self.secDB:
             self.secDB.close()
+            self.secDB = None
         self.primary.close()
+        self.primary = None
 
     def getDB(self):
         return self.primary