churchyard / rpms / python2

Forked from rpms/python2 6 years ago
Clone
4b97eeb
diff -up Python-2.7.1/Lib/test/test_abc.py.cache_leak Python-2.7.1/Lib/test/test_abc.py
4b97eeb
--- Python-2.7.1/Lib/test/test_abc.py.cache_leak	2010-12-28 18:06:35.551938356 -0500
4b97eeb
+++ Python-2.7.1/Lib/test/test_abc.py	2010-12-28 18:09:09.021059202 -0500
4b97eeb
@@ -3,6 +3,8 @@
4b97eeb
 
4b97eeb
 """Unit tests for abc.py."""
4b97eeb
 
4b97eeb
+import sys
4b97eeb
+
4b97eeb
 import unittest, weakref
4b97eeb
 from test import test_support
4b97eeb
 
4b97eeb
@@ -229,8 +231,12 @@ class TestABC(unittest.TestCase):
4b97eeb
         # Trigger cache.
4b97eeb
         C().f()
4b97eeb
         del C
4b97eeb
-        test_support.gc_collect()
4b97eeb
-        self.assertEqual(r(), None)
4b97eeb
+        # This doesn't work in our debug build, presumably due to its use
4b97eeb
+        # of COUNT_ALLOCS, which makes heap-allocated types immortal (once
4b97eeb
+        # they've ever had an instance):
4b97eeb
+        if not hasattr(sys, 'getcounts'):
4b97eeb
+            test_support.gc_collect()
4b97eeb
+            self.assertEqual(r(), None)
4b97eeb
 
4b97eeb
 def test_main():
4b97eeb
     test_support.run_unittest(TestABC)