gh-132775: Clean Up Cross-Interpreter Error Handling (gh-135369)
In this refactor we: * move some code around * make a couple of typedefs opaque * decouple errors from session state * improve tracebacks for propagated exceptions This change helps simplify several upcoming changes.
This commit is contained in:
@@ -7,13 +7,6 @@ _ensure_current_cause(PyThreadState *tstate, PyObject *cause)
|
||||
}
|
||||
PyObject *exc = _PyErr_GetRaisedException(tstate);
|
||||
assert(exc != NULL);
|
||||
PyObject *ctx = PyException_GetContext(exc);
|
||||
if (ctx == NULL) {
|
||||
PyException_SetContext(exc, Py_NewRef(cause));
|
||||
}
|
||||
else {
|
||||
Py_DECREF(ctx);
|
||||
}
|
||||
assert(PyException_GetCause(exc) == NULL);
|
||||
PyException_SetCause(exc, Py_NewRef(cause));
|
||||
_PyErr_SetRaisedException(tstate, exc);
|
||||
|
||||
Reference in New Issue
Block a user