summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-20 00:57:43 +0200
committerVictor Stinner <victor.stinner@gmail.com>2016-08-20 00:57:43 +0200
commit6bdc22306527e58061bad2e49ab3bb4b525a2f86 (patch)
tree4ec6bc9b432159e8ec16c1b27f93e81d930a8e20 /Python/pythonrun.c
parenta3c8f9cb0c66423277a78c96665190349499a60c (diff)
downloadcpython-6bdc22306527e58061bad2e49ab3bb4b525a2f86.tar.gz
PyErr_PrintEx() now uses fast call
Issue #27128.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 678ebfe5f6..2968b34cc8 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -630,8 +630,13 @@ PyErr_PrintEx(int set_sys_last_vars)
}
hook = _PySys_GetObjectId(&PyId_excepthook);
if (hook) {
- PyObject *args = PyTuple_Pack(3, exception, v, tb);
- PyObject *result = PyEval_CallObject(hook, args);
+ PyObject* stack[3];
+ PyObject *result;
+
+ stack[0] = exception;
+ stack[1] = v;
+ stack[2] = tb;
+ result = _PyObject_FastCall(hook, stack, 3, NULL);
if (result == NULL) {
PyObject *exception2, *v2, *tb2;
if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
@@ -660,7 +665,6 @@ PyErr_PrintEx(int set_sys_last_vars)
Py_XDECREF(tb2);
}
Py_XDECREF(result);
- Py_XDECREF(args);
} else {
PySys_WriteStderr("sys.excepthook is missing\n");
PyErr_Display(exception, v, tb);