summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_trace.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2004-03-22 19:30:39 (GMT)
committerArmin Rigo <arigo@tunes.org>2004-03-22 19:30:39 (GMT)
commit706933821c88508299a292e8bb20bf22a9f6364b (patch)
treed689670ef14d012fd306974c77f05fa2961dbe1c /Lib/test/test_trace.py
parentbf57a14522f267fc567feb5472730a6a895a8bfb (diff)
downloadcpython-706933821c88508299a292e8bb20bf22a9f6364b.zip
cpython-706933821c88508299a292e8bb20bf22a9f6364b.tar.gz
cpython-706933821c88508299a292e8bb20bf22a9f6364b.tar.bz2
The fix in ceval.c 2.386 allows iteration-by-iteration line tracing even in
single-line loops.
Diffstat (limited to 'Lib/test/test_trace.py')
-rw-r--r--Lib/test/test_trace.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index 6aac8df..f85c669 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -165,6 +165,27 @@ tightloop_example.events = [(0, 'call'),
(7, 'line'),
(7, 'return')]
+def tighterloop_example():
+ items = range(1, 4)
+ try:
+ i = 0
+ while 1: i = items[i]
+ except IndexError:
+ pass
+
+tighterloop_example.events = [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (4, 'line'),
+ (4, 'line'),
+ (4, 'line'),
+ (4, 'line'),
+ (4, 'exception'),
+ (5, 'line'),
+ (6, 'line'),
+ (6, 'return')]
+
class Tracer:
def __init__(self):
self.events = []
@@ -220,6 +241,8 @@ class TraceTestCase(unittest.TestCase):
self.run_test(ireturn_example)
def test_11_tightloop(self):
self.run_test(tightloop_example)
+ def test_12_tighterloop(self):
+ self.run_test(tighterloop_example)
class RaisingTraceFuncTestCase(unittest.TestCase):
def trace(self, frame, event, arg):