summaryrefslogtreecommitdiff
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-04-01 00:04:33 +0000
committerGeorg Brandl <georg@python.org>2009-04-01 00:04:33 +0000
commitd8fb6ac9da7256d6cdb22c4b4c2d7ed06fba60d6 (patch)
tree148ef8c81ad5b550726c0b805a04e007e7712b96 /Lib/test/test_sys.py
parentd60c29ed8b12fda1d129e21b80a5d9ce4125a21a (diff)
downloadcpython-git-d8fb6ac9da7256d6cdb22c4b4c2d7ed06fba60d6.tar.gz
Issue #5635: Fix running test_sys with tracing enabled.
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index a4554a67ba..afeaf251b1 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -221,6 +221,11 @@ class SysModuleTest(unittest.TestCase):
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