gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Python/) (#102193)

This commit is contained in:
Irit Katriel 2023-02-28 11:50:52 +00:00 committed by GitHub
parent 85b1fc1fc5
commit 4c87537efb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 72 deletions

View file

@ -2,7 +2,7 @@
#include "Python.h"
#include "pycore_atomic.h" // _Py_atomic_int
#include "pycore_ceval.h" // _PyEval_SignalReceived()
#include "pycore_pyerrors.h" // _PyErr_Fetch()
#include "pycore_pyerrors.h" // _PyErr_GetRaisedException()
#include "pycore_pylifecycle.h" // _PyErr_Print()
#include "pycore_initconfig.h" // _PyStatus_OK()
#include "pycore_interp.h" // _Py_RunGC()
@ -870,10 +870,9 @@ _Py_FinishPendingCalls(PyThreadState *tstate)
}
if (make_pending_calls(tstate->interp) < 0) {
PyObject *exc, *val, *tb;
_PyErr_Fetch(tstate, &exc, &val, &tb);
PyObject *exc = _PyErr_GetRaisedException(tstate);
PyErr_BadInternalCall();
_PyErr_ChainExceptions(exc, val, tb);
_PyErr_ChainExceptions1(exc);
_PyErr_Print(tstate);
}
}