Skip to content

Commit 71cb64a

Browse files
committed
PyErr_PrintEx() now uses fast call
Issue python#27128.
1 parent df142fd commit 71cb64a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Python/pythonrun.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,13 @@ PyErr_PrintEx(int set_sys_last_vars)
630630
}
631631
hook = _PySys_GetObjectId(&PyId_excepthook);
632632
if (hook) {
633-
PyObject *args = PyTuple_Pack(3, exception, v, tb);
634-
PyObject *result = PyEval_CallObject(hook, args);
633+
PyObject* stack[3];
634+
PyObject *result;
635+
636+
stack[0] = exception;
637+
stack[1] = v;
638+
stack[2] = tb;
639+
result = _PyObject_FastCall(hook, stack, 3, NULL);
635640
if (result == NULL) {
636641
PyObject *exception2, *v2, *tb2;
637642
if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
@@ -660,7 +665,6 @@ PyErr_PrintEx(int set_sys_last_vars)
660665
Py_XDECREF(tb2);
661666
}
662667
Py_XDECREF(result);
663-
Py_XDECREF(args);
664668
} else {
665669
PySys_WriteStderr("sys.excepthook is missing\n");
666670
PyErr_Display(exception, v, tb);

0 commit comments

Comments
 (0)