]> granicus.if.org Git - python/commitdiff
Second fix for issue #4373
authorChristian Heimes <christian@cheimes.de>
Tue, 25 Nov 2008 21:21:32 +0000 (21:21 +0000)
committerChristian Heimes <christian@cheimes.de>
Tue, 25 Nov 2008 21:21:32 +0000 (21:21 +0000)
Lib/distutils/tests/test_build_ext.py
Misc/NEWS

index 552a3d1440e5c23eef2c8949d2545eda000ce447..527529777d8ac50a6b21ea5655849cee649a5fe9 100644 (file)
@@ -11,6 +11,10 @@ from distutils import sysconfig
 import unittest
 from test import support
 
+# http://bugs.python.org/issue4373
+# Don't load the xx module more than once.
+ALREADY_TESTED = False
+
 class BuildExtTestCase(unittest.TestCase):
     def setUp(self):
         # Create a simple test environment
@@ -23,6 +27,7 @@ class BuildExtTestCase(unittest.TestCase):
         shutil.copy(xx_c, self.tmp_dir)
 
     def test_build_ext(self):
+        global ALREADY_TESTED
         xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
         xx_ext = Extension('xx', [xx_c])
         dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
@@ -45,6 +50,11 @@ class BuildExtTestCase(unittest.TestCase):
         finally:
             sys.stdout = old_stdout
 
+        if ALREADY_TESTED:
+            return
+        else:
+            ALREADY_TESTED = True
+
         import xx
 
         for attr in ('error', 'foo', 'new', 'roj'):
index 50a33315644f06182db4ba14055cc0bdf942bfd0..535cca4ac4637a0c8d98921a506edd223705d650 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -22,7 +22,8 @@ Core and Builtins
 Library
 -------
 
-- Issue #4373: Corrected a potential reference leak in the pickle module.
+- Issue #4373: Corrected a potential reference leak in the pickle module and
+  silenced a false positive ref leak in distutils.tests.test_build_ext.
 
 - Issue #4382: dbm.dumb did not specify the expected file encoding for opened
   files.