cpython: call_function(): document PyMethod optimization
https://hg.python.org/cpython/rev/c085f2e0e1af changeset: 105385:c085f2e0e1af user: Victor Stinner <victor.stinner@gmail.com> date: Mon Nov 28 18:32:31 2016 +0100 summary: call_function(): document PyMethod optimization files: Python/ceval.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4736,7 +4736,11 @@ } else { if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) { - /* optimize access to bound methods */ + /* Optimize access to bound methods. Reuse the Python stack + to pass 'self' as the first argument, replace 'func' + with 'self'. It avoids the creation of a new temporary tuple + for arguments (to replace func with self) when the method uses + FASTCALL. */ PyObject *self = PyMethod_GET_SELF(func); Py_INCREF(self); func = PyMethod_GET_FUNCTION(func); -- Repository URL: https://hg.python.org/cpython
participants (1)
-
victor.stinner