summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-07-03 18:20:15 (GMT)
committerGitHub <noreply@github.com>2017-07-03 18:20:15 (GMT)
commit6969eaf4682beb01bc95eeb14f5ce6c01312e297 (patch)
treec81a3d9bca3e9d01f557c46a8534a4e3873403f9 /Tools
parentaa0aa0492c5fffe750a26d2ab13737a1a6d7d63c (diff)
downloadcpython-6969eaf4682beb01bc95eeb14f5ce6c01312e297.zip
cpython-6969eaf4682beb01bc95eeb14f5ce6c01312e297.tar.gz
cpython-6969eaf4682beb01bc95eeb14f5ce6c01312e297.tar.bz2
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.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/clinic/clinic.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 22cde14..91d8440 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -710,6 +710,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,