[Python-checkins] cpython: PyErr_PrintEx() now uses fast call

victor.stinner python-checkins at python.org
Fri Aug 19 19:50:39 EDT 2016


https://hg.python.org/cpython/rev/e5b24f595235
changeset:   102784:e5b24f595235
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Aug 20 00:57:43 2016 +0200
summary:
  PyErr_PrintEx() now uses fast call

Issue #27128.

files:
  Python/pythonrun.c |  10 +++++++---
  1 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Python/pythonrun.c b/Python/pythonrun.c
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -630,8 +630,13 @@
     }
     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 @@
             Py_XDECREF(tb2);
         }
         Py_XDECREF(result);
-        Py_XDECREF(args);
     } else {
         PySys_WriteStderr("sys.excepthook is missing\n");
         PyErr_Display(exception, v, tb);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list