summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNicholas Bastin <nick.bastin@gmail.com>2004-03-22 19:21:47 (GMT)
committerNicholas Bastin <nick.bastin@gmail.com>2004-03-22 19:21:47 (GMT)
commitfa7bec7e837e99aaa77009d324935c0ffca6891d (patch)
tree879f11f90e58c5bc2e204be08387f03d081dc63d /Lib/test
parentaea9459cb1d335dda003ebd39b3882bf712fb03e (diff)
downloadcpython-fa7bec7e837e99aaa77009d324935c0ffca6891d.zip
cpython-fa7bec7e837e99aaa77009d324935c0ffca6891d.tar.gz
cpython-fa7bec7e837e99aaa77009d324935c0ffca6891d.tar.bz2
Test for tight loop line event fix, SF bug #765624
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_trace.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index 93ad688..4103794 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -141,6 +141,29 @@ ireturn_example.events = [(0, 'call'),
(4, 'line'),
(4, 'return')]
+# Tight loop with while(1) example (SF #765624)
+def tightloop_example():
+ items = range(0, 3)
+ try:
+ i = 0
+ while 1:
+ print items[i]; i+=1
+ except IndexError:
+ pass
+
+tightloop_example.events = [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (4, 'line'),
+ (5, 'line'),
+ (5, 'line'),
+ (5, 'line'),
+ (5, 'exception'),
+ (6, 'line'),
+ (7, 'line'),
+ (7, 'return')]
+
class Tracer:
def __init__(self):
self.events = []
@@ -194,6 +217,8 @@ class TraceTestCase(unittest.TestCase):
self.run_test2(settrace_and_raise)
def test_10_ireturn(self):
self.run_test(ireturn_example)
+ def test_11_tightloop(self):
+ self.run_test(tightloop_example)
class RaisingTraceFuncTestCase(unittest.TestCase):
def trace(self, frame, event, arg):