[Python-checkins] bpo-37484: use _PyObject_Vectorcall for __exit__ (GH-14557)

Inada Naoki webhook-mailer at python.org
Wed Jul 3 06:52:28 EDT 2019


https://github.com/python/cpython/commit/469d1a70cecc918499c288fc0e5e3d79711bc5e5
commit: 469d1a70cecc918499c288fc0e5e3d79711bc5e5
branch: master
author: Jeroen Demeyer <J.Demeyer at UGent.be>
committer: Inada Naoki <songofacandy at gmail.com>
date: 2019-07-03T19:52:21+09:00
summary:

bpo-37484: use _PyObject_Vectorcall for __exit__ (GH-14557)

files:
M Python/ceval.c

diff --git a/Python/ceval.c b/Python/ceval.c
index 5d29d41cf80c..888749b699e9 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3314,7 +3314,6 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
 
                Finally we push the result of the call.
             */
-            PyObject *stack[3];
             PyObject *exit_func;
             PyObject *exc, *val, *tb, *res;
 
@@ -3351,10 +3350,9 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
                 block->b_level--;
             }
 
-            stack[0] = exc;
-            stack[1] = val;
-            stack[2] = tb;
-            res = _PyObject_FastCall(exit_func, stack, 3);
+            PyObject *stack[4] = {NULL, exc, val, tb};
+            res = _PyObject_Vectorcall(exit_func, stack + 1,
+                    3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
             Py_DECREF(exit_func);
             if (res == NULL)
                 goto error;



More information about the Python-checkins mailing list