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

This commit is contained in:
Irit Katriel 2023-03-19 15:17:59 +00:00 committed by GitHub
parent 3adb23a17d
commit ad77b80b05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 334 additions and 342 deletions

View file

@ -778,9 +778,7 @@ dummy_func(
}
assert(exc && PyExceptionInstance_Check(exc));
Py_INCREF(exc);
PyObject *typ = Py_NewRef(PyExceptionInstance_Class(exc));
PyObject *tb = PyException_GetTraceback(exc);
_PyErr_Restore(tstate, typ, exc, tb);
_PyErr_SetRaisedException(tstate, exc);
goto exception_unwind;
}
@ -791,9 +789,7 @@ dummy_func(
}
else {
Py_INCREF(exc);
PyObject *typ = Py_NewRef(PyExceptionInstance_Class(exc));
PyObject *tb = PyException_GetTraceback(exc);
_PyErr_Restore(tstate, typ, exc, tb);
_PyErr_SetRaisedException(tstate, exc);
goto exception_unwind;
}
}