mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)
the bare METH_FASTCALL be used for functions with positional-only parameters.
This commit is contained in:
parent
aa0aa0492c
commit
6969eaf468
76 changed files with 616 additions and 1916 deletions
|
@ -709,6 +709,11 @@ class CLanguage(Language):
|
|||
""")
|
||||
|
||||
parser_prototype_fastcall = normalize_snippet("""
|
||||
static PyObject *
|
||||
{c_basename}({self_type}{self_name}, PyObject **args, Py_ssize_t nargs)
|
||||
""")
|
||||
|
||||
parser_prototype_fastcall_keywords = normalize_snippet("""
|
||||
static PyObject *
|
||||
{c_basename}({self_type}{self_name}, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
""")
|
||||
|
@ -828,10 +833,6 @@ class CLanguage(Language):
|
|||
parser_prototype = parser_prototype_fastcall
|
||||
|
||||
parser_definition = parser_body(parser_prototype, normalize_snippet("""
|
||||
if ({self_type_check}!_PyArg_NoStackKeywords("{name}", kwnames)) {{
|
||||
goto exit;
|
||||
}}
|
||||
|
||||
if (!_PyArg_UnpackStack(args, nargs, "{name}",
|
||||
{unpack_min}, {unpack_max},
|
||||
{parse_arguments})) {{
|
||||
|
@ -859,10 +860,6 @@ class CLanguage(Language):
|
|||
parser_prototype = parser_prototype_fastcall
|
||||
|
||||
parser_definition = parser_body(parser_prototype, normalize_snippet("""
|
||||
if ({self_type_check}!_PyArg_NoStackKeywords("{name}", kwnames)) {{
|
||||
goto exit;
|
||||
}}
|
||||
|
||||
if (!_PyArg_ParseStack(args, nargs, "{format_units}:{name}",
|
||||
{parse_arguments})) {{
|
||||
goto exit;
|
||||
|
@ -883,9 +880,9 @@ class CLanguage(Language):
|
|||
""", indent=4))
|
||||
|
||||
elif not new_or_init:
|
||||
flags = "METH_FASTCALL"
|
||||
flags = "METH_FASTCALL|METH_KEYWORDS"
|
||||
|
||||
parser_prototype = parser_prototype_fastcall
|
||||
parser_prototype = parser_prototype_fastcall_keywords
|
||||
|
||||
body = normalize_snippet("""
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue