From ad77b80b0542a71eff54d1a193bd044a71e8e00b Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sun, 19 Mar 2023 15:17:59 +0000 Subject: gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (#102816) --- Python/bytecodes.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'Python/bytecodes.c') diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 74582ecbbd..6c44870730 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -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; } } -- cgit v1.2.1