cpython: de90f3d06bc9 (original) (raw)

Mercurial > cpython

changeset 106178:de90f3d06bc9

Argument Clinic: Use METH_FASTCALL for positionals Issue #29286. Use METH_FASTCALL calling convention instead of METH_VARARGS to parse position arguments. METH_FASTCALL is faster since it avoids the creation of a temporary tuple to pass positional arguments. [#29286]

Victor Stinner victor.stinner@gmail.com
date Tue, 17 Jan 2017 01:42:54 +0100
parents 38ab8572fde2
children dea8922751a1
files Tools/clinic/clinic.py
diffstat 1 files changed, 35 insertions(+), 17 deletions(-)[+] [-] Tools/clinic/clinic.py 52

line wrap: on

line diff

--- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -705,16 +705,16 @@ class CLanguage(Language): {c_basename}({self_type}{self_name}, PyObject *args, PyObject *kwargs) """)

+ parser_prototype_fastcall = normalize_snippet(""" static PyObject * {c_basename}({self_type}{self_name}, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) """)

- # parser_body_fields remembers the fields passed in to the # previous call to parser_body. this is used for an awful hack. parser_body_fields = () @@ -837,18 +837,36 @@ class CLanguage(Language): """, indent=4)) elif positional:

-

-

+

+

+

+

+

elif not new_or_init: flags = "METH_FASTCALL"