Mailing List Archive

python/dist/src/Lib/test test_trace.py,1.3,1.4
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv1712/src/Lib/test

Modified Files:
test_trace.py
Log Message:
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 ;-).



Index: test_trace.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_trace.py 11 Sep 2002 15:36:32 -0000 1.3
--- test_trace.py 2 Oct 2002 13:13:46 -0000 1.4
***************
*** 178,183 ****
--- 178,203 ----
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__":