summaryrefslogtreecommitdiff
path: root/Lib/test/test_trace.py
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-10-02 13:13:45 +0000
committerMichael W. Hudson <mwh@python.net>2002-10-02 13:13:45 +0000
commit33aca606895f163418ce822b4dae1a653189d03b (patch)
treeb370a7f9c1ac84daec6d695c40256ee0ca5b70c8 /Lib/test/test_trace.py
parent104c4156f6693fc9c9037da62e15a589b10bfa1b (diff)
downloadcpython-33aca606895f163418ce822b4dae1a653189d03b.tar.gz
Fix for the recursion_level bug Armin Rigo reported in sf
patch #617312, both on the trunk and the 22-maint branch. Also added a test case, and ported the test_trace I wrote for HEAD to 2.2.2 (with all those horrible extra 'line' events ;-).
Diffstat (limited to 'Lib/test/test_trace.py')
-rw-r--r--Lib/test/test_trace.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index 314801d8bd..91112e8b21 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -177,8 +177,28 @@ class TraceTestCase(unittest.TestCase):
def test_9_settrace_and_raise(self):
self.run_test2(settrace_and_raise)
+class RaisingTraceFuncTestCase(unittest.TestCase):
+ def test_it(self):
+ def tr(frame, event, arg):
+ raise ValueError # just something that isn't RuntimeError
+ def f():
+ return 1
+ try:
+ for i in xrange(sys.getrecursionlimit() + 1):
+ sys.settrace(tr)
+ try:
+ f()
+ except ValueError:
+ pass
+ else:
+ self.fail("exception not thrown!")
+ except RuntimeError:
+ self.fail("recursion counter not reset")
+
+
def test_main():
test_support.run_unittest(TraceTestCase)
+ test_support.run_unittest(RaisingTraceFuncTestCase)
if __name__ == "__main__":
test_main()