diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-10 00:40:38 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-10 00:40:38 (GMT) |
commit | f0ccbbbc577f686ae5b4ab28a8e61bb524433d2d (patch) | |
tree | 1454cb02eef602371ce84bdf3c88621375a46df9 /Tools/clinic | |
parent | a9efb2f56eb6bcb97cebfadf1e778b4cb979357f (diff) | |
download | cpython-f0ccbbbc577f686ae5b4ab28a8e61bb524433d2d.zip cpython-f0ccbbbc577f686ae5b4ab28a8e61bb524433d2d.tar.gz cpython-f0ccbbbc577f686ae5b4ab28a8e61bb524433d2d.tar.bz2 |
Emit METH_FASTCALL code in Argument Clinic
Issue #27810:
* Modify vgetargskeywordsfast() to work on a C array of PyObject* rather than
working on a tuple directly.
* Add _PyArg_ParseStack()
* Argument Clinic now emits code using the new METH_FASTCALL calling convention
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-x | Tools/clinic/clinic.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index afd1a5f..75ac673 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -705,6 +705,11 @@ 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_prototype_varargs = normalize_snippet(""" static PyObject * {c_basename}({self_type}{self_name}, PyObject *args) @@ -845,6 +850,19 @@ class CLanguage(Language): }} """, indent=4)) + elif not new_or_init: + flags = "METH_FASTCALL" + + parser_prototype = parser_prototype_fastcall + + body = normalize_snippet(""" + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + {parse_arguments})) {{ + goto exit; + }} + """, indent=4) + parser_definition = parser_body(parser_prototype, body) + parser_definition = insert_keywords(parser_definition) else: # positional-or-keyword arguments flags = "METH_VARARGS|METH_KEYWORDS" |