summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys_settrace.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r--Lib/test/test_sys_settrace.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index 63ae1b7..f0b0b82 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -458,6 +458,29 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
self.fail("exception not propagated")
+ def test_exception_arguments(self):
+ def f():
+ x = 0
+ # this should raise an error
+ x.no_such_attr
+ def g(frame, event, arg):
+ if (event == 'exception'):
+ type, exception, trace = arg
+ self.assertIsInstance(exception, Exception)
+ return g
+
+ existing = sys.gettrace()
+ try:
+ sys.settrace(g)
+ try:
+ f()
+ except AttributeError:
+ # this is expected
+ pass
+ finally:
+ sys.settrace(existing)
+
+
# 'Jump' tests: assigning to frame.f_lineno within a trace function
# moves the execution position - it's how debuggers implement a Jump
# command (aka. "Set next statement").