Ejemplo n.º 1
0
Box* sysExcInfo() {
    ExcInfo* exc = getFrameExcInfo();
    assert(exc->type);
    assert(exc->value);
    Box* tb = exc->traceback ? exc->traceback : None;
    return BoxedTuple::create({ exc->type, exc->value, tb });
}
Ejemplo n.º 2
0
Box* sysExcInfo() {
    ExcInfo* exc = getFrameExcInfo();
    assert(exc->type);
    assert(exc->value);
    assert(exc->traceback);
    return BoxedTuple::create({ exc->type, exc->value, exc->traceback });
}
Ejemplo n.º 3
0
void raise0() {
    ExcInfo* exc_info = getFrameExcInfo();
    assert(exc_info->type);

    // TODO need to clean up when we call normalize, do_raise, etc
    if (exc_info->type == None)
        raiseExcHelper(TypeError, "exceptions must be old-style classes or derived from BaseException, not NoneType");

    raiseRaw(*exc_info);
}
Ejemplo n.º 4
0
Box* sysExcClear() {
    ExcInfo* exc = getFrameExcInfo();
    assert(exc->type);
    assert(exc->value);
    assert(exc->traceback);

    exc->type = None;
    exc->value = None;
    exc->traceback = None;

    return None;
}
Ejemplo n.º 5
0
Box* sysExcClear() {
    ExcInfo* exc = getFrameExcInfo();
    assert(exc->type);
    assert(exc->value);

    Box* old_type = exc->type;
    Box* old_value = exc->value;
    Box* old_traceback = exc->traceback;
    exc->type = incref(None);
    exc->value = incref(None);
    exc->traceback = NULL;
    Py_DECREF(old_type);
    Py_DECREF(old_value);
    Py_XDECREF(old_traceback);

    Py_RETURN_NONE;
}