summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2003-04-29 16:18:47 (GMT)
committerMichael W. Hudson <mwh@python.net>2003-04-29 16:18:47 (GMT)
commit58ee2af48ecc353bd56fab588c85248a2f1bc373 (patch)
tree82cd9cbba15eb6f84bdb6d39ef9aed1e240ae65c /Lib
parent572f5233f0263ab75782bbce4bd67259d73e32ac (diff)
downloadcpython-58ee2af48ecc353bd56fab588c85248a2f1bc373.zip
cpython-58ee2af48ecc353bd56fab588c85248a2f1bc373.tar.gz
cpython-58ee2af48ecc353bd56fab588c85248a2f1bc373.tar.bz2
Armin Rigo's fix & test for
[ 729622 ] line tracing hook errors with massaging from me to integrate test into test suite.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_trace.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index f973a19..21e5ca9 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -221,6 +221,27 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
def test_exception(self):
self.run_test_for_event('exception')
+ def test_trash_stack(self):
+ def f():
+ for i in range(5):
+ print i # line tracing will raise an exception at this line
+
+ def g(frame, why, extra):
+ if (why == 'line' and
+ frame.f_lineno == f.func_code.co_firstlineno + 2):
+ raise RuntimeError, "i am crashing"
+ return g
+
+ sys.settrace(g)
+ try:
+ f()
+ except RuntimeError:
+ # the test is really that this doesn't segfault:
+ import gc
+ gc.collect()
+ else:
+ self.fail("exception not propagated")
+
# 'Jump' tests: assigning to frame.f_lineno within a trace function
# moves the execution position - it's how debuggers implement a Jump