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").
Core and Builtins
-----------------
+- Issue #17413: sys.settrace callbacks were being passed a string instead of an
+ exception instance for the 'value' element of the arg tuple if the exception
+ originated from C code; now an exception instance is always provided.
+
- Issue #17782: Fix undefined behaviour on platforms where
``struct timespec``'s "tv_nsec" member is not a C long.
value = Py_None;
Py_INCREF(value);
}
+ PyErr_NormalizeException(&type, &value, &traceback);
arg = PyTuple_Pack(3, type, value, traceback);
if (arg == NULL) {
PyErr_Restore(type, value, traceback);