mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Issue #5635: Fix running test_sys with tracing enabled.
This commit is contained in:
parent
d60c29ed8b
commit
d8fb6ac9da
2 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue