summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_frame.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_frame.py')
-rw-r--r--Lib/test/test_frame.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_frame.py b/Lib/test/test_frame.py
index a8696f0..7ac37b6 100644
--- a/Lib/test/test_frame.py
+++ b/Lib/test/test_frame.py
@@ -1,4 +1,5 @@
import re
+import sys
import types
import unittest
import weakref
@@ -94,6 +95,26 @@ class ClearTest(unittest.TestCase):
f.clear()
self.assertTrue(endly)
+ def test_lineno_with_tracing(self):
+ def record_line():
+ f = sys._getframe(1)
+ lines.append(f.f_lineno-f.f_code.co_firstlineno)
+
+ def test(trace):
+ record_line()
+ if trace:
+ sys._getframe(0).f_trace = True
+ record_line()
+ record_line()
+
+ expected_lines = [1, 4, 5]
+ lines = []
+ test(False)
+ self.assertEqual(lines, expected_lines)
+ lines = []
+ test(True)
+ self.assertEqual(lines, expected_lines)
+
@support.cpython_only
def test_clear_refcycles(self):
# .clear() doesn't leave any refcycle behind