Skip to content

Commit d7a4c4c

Browse files
committed
pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives
1 parent 1cb75a9 commit d7a4c4c

File tree

4 files changed

+332
-342
lines changed

4 files changed

+332
-342
lines changed

Python/bytecodes.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -778,9 +778,7 @@ dummy_func(
778778
}
779779
assert(exc && PyExceptionInstance_Check(exc));
780780
Py_INCREF(exc);
781-
PyObject *typ = Py_NewRef(PyExceptionInstance_Class(exc));
782-
PyObject *tb = PyException_GetTraceback(exc);
783-
_PyErr_Restore(tstate, typ, exc, tb);
781+
_PyErr_SetRaisedException(tstate, exc);
784782
goto exception_unwind;
785783
}
786784

@@ -791,9 +789,7 @@ dummy_func(
791789
}
792790
else {
793791
Py_INCREF(exc);
794-
PyObject *typ = Py_NewRef(PyExceptionInstance_Class(exc));
795-
PyObject *tb = PyException_GetTraceback(exc);
796-
_PyErr_Restore(tstate, typ, exc, tb);
792+
_PyErr_SetRaisedException(tstate, exc);
797793
goto exception_unwind;
798794
}
799795
}

0 commit comments

Comments
 (0)