summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-10-02 13:13:45 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-10-02 13:13:45 (GMT)
commitfb4d6ecd0757c0863b8a2e45a57a6dfec13fbff6 (patch)
tree990b8cb3dffce52639bfa8929f6956ad0f1e49a2 /Lib
parent3c6d6f2ff70a4ff6c7894c64ff8f86c77092797a (diff)
downloadcpython-fb4d6ecd0757c0863b8a2e45a57a6dfec13fbff6.zip
cpython-fb4d6ecd0757c0863b8a2e45a57a6dfec13fbff6.tar.gz
cpython-fb4d6ecd0757c0863b8a2e45a57a6dfec13fbff6.tar.bz2
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')
-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 314801d..91112e8 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()