[Python-checkins] r70933 - in python/trunk: Lib/test/test_sys.py Misc/NEWS

georg.brandl python-checkins at python.org
Wed Apr 1 02:04:33 CEST 2009


Author: georg.brandl
Date: Wed Apr  1 02:04:33 2009
New Revision: 70933

Log:
Issue #5635: Fix running test_sys with tracing enabled.


Modified:
   python/trunk/Lib/test/test_sys.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/test/test_sys.py
==============================================================================
--- python/trunk/Lib/test/test_sys.py	(original)
+++ python/trunk/Lib/test/test_sys.py	Wed Apr  1 02:04:33 2009
@@ -221,6 +221,11 @@
             sys.setdlopenflags(oldflags)
 
     def test_refcount(self):
+        # n here must be a global in order for this test to pass while
+        # tracing with a python function.  Tracing calls PyFrame_FastToLocals
+        # which will add a copy of any locals to the frame object, causing
+        # the reference count to increase by 2 instead of 1.
+        global n
         self.assertRaises(TypeError, sys.getrefcount)
         c = sys.getrefcount(None)
         n = None

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Apr  1 02:04:33 2009
@@ -1,4 +1,5 @@
-+++++++++++ Python News
++++++++++++
+Python News
 +++++++++++
 
 (editors: check NEWS.help for information about editing NEWS using ReST.)
@@ -715,6 +716,8 @@
 Tests
 -----
 
+- Issue #5635: Fix running test_sys with tracing enabled.
+
 - regrtest no longer treats ImportError as equivalent to SkipTest.  Imports
   that should cause a test to be skipped are now done using import_module 
   from test support, which does the conversion.


More information about the Python-checkins mailing list