Commit c2f81a09 authored by Kevin Modzelewski's avatar Kevin Modzelewski

raise0_capi

parent f78c923d
......@@ -176,21 +176,22 @@ extern "C" void raise0(ExcInfo* frame_exc_info) {
}
extern "C" void raise0_capi(ExcInfo* frame_exc_info) noexcept {
assert(0 && "check refcounting");
updateFrameExcInfoIfNeeded(frame_exc_info);
assert(frame_exc_info->type);
// TODO need to clean up when we call normalize, do_raise, etc
if (frame_exc_info->type == None) {
assert(0 && "check refcounting");
frame_exc_info->type = TypeError;
frame_exc_info->value
= boxString("exceptions must be old-style classes or derived from BaseException, not NoneType");
frame_exc_info->traceback = NULL;
PyErr_NormalizeException(&frame_exc_info->type, &frame_exc_info->value, &frame_exc_info->traceback);
PyErr_SetString(TypeError, "exceptions must be old-style classes or derived from BaseException, not NoneType");
return;
}
startReraise();
assert(!PyErr_Occurred());
Py_INCREF(frame_exc_info->type);
Py_INCREF(frame_exc_info->value);
Py_INCREF(frame_exc_info->traceback);
PyErr_Restore(frame_exc_info->type, frame_exc_info->value, frame_exc_info->traceback);
}
......
# expected: reffail
# should_error
# Different ways of nesting exceptions
......
# expected: reffail
# A test of both the tracebacks we generate and the traceback module
#
# (We keep fixing tracebacks in one case to break them in another, so it's time for a test.)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment