diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-01-17 01:21:47 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-01-17 01:21:47 (GMT) |
commit | 0c4a828cadfccd8b95a39f7930705de75ed5f729 (patch) | |
tree | 713eeceb5c63f4324fa83e9603a0284272e9eb58 /Modules/clinic | |
parent | 093119e4eb8424451ef24a5a5a3ce9881d77abd5 (diff) | |
download | cpython-0c4a828cadfccd8b95a39f7930705de75ed5f729.zip cpython-0c4a828cadfccd8b95a39f7930705de75ed5f729.tar.gz cpython-0c4a828cadfccd8b95a39f7930705de75ed5f729.tar.bz2 |
Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling
convention for functions using "boring" positional arguments.
Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain
consistent with the clinic code.
Diffstat (limited to 'Modules/clinic')
-rw-r--r-- | Modules/clinic/_elementtree.c.h | 52 | ||||
-rw-r--r-- | Modules/clinic/_gdbmmodule.c.h | 22 | ||||
-rw-r--r-- | Modules/clinic/_pickle.c.h | 12 | ||||
-rw-r--r-- | Modules/clinic/_sre.c.h | 32 | ||||
-rw-r--r-- | Modules/clinic/signalmodule.c.h | 12 |
5 files changed, 89 insertions, 41 deletions
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h index 410794e..c13cb35 100644 --- a/Modules/clinic/_elementtree.c.h +++ b/Modules/clinic/_elementtree.c.h @@ -423,24 +423,28 @@ PyDoc_STRVAR(_elementtree_Element_makeelement__doc__, "\n"); #define _ELEMENTTREE_ELEMENT_MAKEELEMENT_METHODDEF \ - {"makeelement", (PyCFunction)_elementtree_Element_makeelement, METH_VARARGS, _elementtree_Element_makeelement__doc__}, + {"makeelement", (PyCFunction)_elementtree_Element_makeelement, METH_FASTCALL, _elementtree_Element_makeelement__doc__}, static PyObject * _elementtree_Element_makeelement_impl(ElementObject *self, PyObject *tag, PyObject *attrib); static PyObject * -_elementtree_Element_makeelement(ElementObject *self, PyObject *args) +_elementtree_Element_makeelement(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *tag; PyObject *attrib; - if (!PyArg_UnpackTuple(args, "makeelement", + if (!_PyArg_UnpackStack(args, nargs, "makeelement", 2, 2, &tag, &attrib)) { goto exit; } + + if (!_PyArg_NoStackKeywords("makeelement", kwnames)) { + goto exit; + } return_value = _elementtree_Element_makeelement_impl(self, tag, attrib); exit: @@ -479,24 +483,28 @@ PyDoc_STRVAR(_elementtree_Element_set__doc__, "\n"); #define _ELEMENTTREE_ELEMENT_SET_METHODDEF \ - {"set", (PyCFunction)_elementtree_Element_set, METH_VARARGS, _elementtree_Element_set__doc__}, + {"set", (PyCFunction)_elementtree_Element_set, METH_FASTCALL, _elementtree_Element_set__doc__}, static PyObject * _elementtree_Element_set_impl(ElementObject *self, PyObject *key, PyObject *value); static PyObject * -_elementtree_Element_set(ElementObject *self, PyObject *args) +_elementtree_Element_set(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *key; PyObject *value; - if (!PyArg_UnpackTuple(args, "set", + if (!_PyArg_UnpackStack(args, nargs, "set", 2, 2, &key, &value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("set", kwnames)) { + goto exit; + } return_value = _elementtree_Element_set_impl(self, key, value); exit: @@ -564,24 +572,28 @@ PyDoc_STRVAR(_elementtree_TreeBuilder_start__doc__, "\n"); #define _ELEMENTTREE_TREEBUILDER_START_METHODDEF \ - {"start", (PyCFunction)_elementtree_TreeBuilder_start, METH_VARARGS, _elementtree_TreeBuilder_start__doc__}, + {"start", (PyCFunction)_elementtree_TreeBuilder_start, METH_FASTCALL, _elementtree_TreeBuilder_start__doc__}, static PyObject * _elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag, PyObject *attrs); static PyObject * -_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject *args) +_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *tag; PyObject *attrs = Py_None; - if (!PyArg_UnpackTuple(args, "start", + if (!_PyArg_UnpackStack(args, nargs, "start", 1, 2, &tag, &attrs)) { goto exit; } + + if (!_PyArg_NoStackKeywords("start", kwnames)) { + goto exit; + } return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs); exit: @@ -651,25 +663,29 @@ PyDoc_STRVAR(_elementtree_XMLParser_doctype__doc__, "\n"); #define _ELEMENTTREE_XMLPARSER_DOCTYPE_METHODDEF \ - {"doctype", (PyCFunction)_elementtree_XMLParser_doctype, METH_VARARGS, _elementtree_XMLParser_doctype__doc__}, + {"doctype", (PyCFunction)_elementtree_XMLParser_doctype, METH_FASTCALL, _elementtree_XMLParser_doctype__doc__}, static PyObject * _elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name, PyObject *pubid, PyObject *system); static PyObject * -_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject *args) +_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *name; PyObject *pubid; PyObject *system; - if (!PyArg_UnpackTuple(args, "doctype", + if (!_PyArg_UnpackStack(args, nargs, "doctype", 3, 3, &name, &pubid, &system)) { goto exit; } + + if (!_PyArg_NoStackKeywords("doctype", kwnames)) { + goto exit; + } return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system); exit: @@ -682,7 +698,7 @@ PyDoc_STRVAR(_elementtree_XMLParser__setevents__doc__, "\n"); #define _ELEMENTTREE_XMLPARSER__SETEVENTS_METHODDEF \ - {"_setevents", (PyCFunction)_elementtree_XMLParser__setevents, METH_VARARGS, _elementtree_XMLParser__setevents__doc__}, + {"_setevents", (PyCFunction)_elementtree_XMLParser__setevents, METH_FASTCALL, _elementtree_XMLParser__setevents__doc__}, static PyObject * _elementtree_XMLParser__setevents_impl(XMLParserObject *self, @@ -690,20 +706,24 @@ _elementtree_XMLParser__setevents_impl(XMLParserObject *self, PyObject *events_to_report); static PyObject * -_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *args) +_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *events_queue; PyObject *events_to_report = Py_None; - if (!PyArg_UnpackTuple(args, "_setevents", + if (!_PyArg_UnpackStack(args, nargs, "_setevents", 1, 2, &events_queue, &events_to_report)) { goto exit; } + + if (!_PyArg_NoStackKeywords("_setevents", kwnames)) { + goto exit; + } return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report); exit: return return_value; } -/*[clinic end generated code: output=4e3d22c6f6d832b2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b69fa98c40917f58 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h index 77d258b..b91cea1 100644 --- a/Modules/clinic/_gdbmmodule.c.h +++ b/Modules/clinic/_gdbmmodule.c.h @@ -9,23 +9,27 @@ PyDoc_STRVAR(_gdbm_gdbm_get__doc__, "Get the value for key, or default if not present."); #define _GDBM_GDBM_GET_METHODDEF \ - {"get", (PyCFunction)_gdbm_gdbm_get, METH_VARARGS, _gdbm_gdbm_get__doc__}, + {"get", (PyCFunction)_gdbm_gdbm_get, METH_FASTCALL, _gdbm_gdbm_get__doc__}, static PyObject * _gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value); static PyObject * -_gdbm_gdbm_get(dbmobject *self, PyObject *args) +_gdbm_gdbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *key; PyObject *default_value = Py_None; - if (!PyArg_UnpackTuple(args, "get", + if (!_PyArg_UnpackStack(args, nargs, "get", 1, 2, &key, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("get", kwnames)) { + goto exit; + } return_value = _gdbm_gdbm_get_impl(self, key, default_value); exit: @@ -39,24 +43,28 @@ PyDoc_STRVAR(_gdbm_gdbm_setdefault__doc__, "Get value for key, or set it to default and return default if not present."); #define _GDBM_GDBM_SETDEFAULT_METHODDEF \ - {"setdefault", (PyCFunction)_gdbm_gdbm_setdefault, METH_VARARGS, _gdbm_gdbm_setdefault__doc__}, + {"setdefault", (PyCFunction)_gdbm_gdbm_setdefault, METH_FASTCALL, _gdbm_gdbm_setdefault__doc__}, static PyObject * _gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key, PyObject *default_value); static PyObject * -_gdbm_gdbm_setdefault(dbmobject *self, PyObject *args) +_gdbm_gdbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *key; PyObject *default_value = Py_None; - if (!PyArg_UnpackTuple(args, "setdefault", + if (!_PyArg_UnpackStack(args, nargs, "setdefault", 1, 2, &key, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setdefault", kwnames)) { + goto exit; + } return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value); exit: @@ -257,4 +265,4 @@ dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) exit: return return_value; } -/*[clinic end generated code: output=1e47d62a35eeba8b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=03a3a63a814ada93 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h index fdba8f9..e10730a 100644 --- a/Modules/clinic/_pickle.c.h +++ b/Modules/clinic/_pickle.c.h @@ -199,7 +199,7 @@ PyDoc_STRVAR(_pickle_Unpickler_find_class__doc__, "needed. Both arguments passed are str objects."); #define _PICKLE_UNPICKLER_FIND_CLASS_METHODDEF \ - {"find_class", (PyCFunction)_pickle_Unpickler_find_class, METH_VARARGS, _pickle_Unpickler_find_class__doc__}, + {"find_class", (PyCFunction)_pickle_Unpickler_find_class, METH_FASTCALL, _pickle_Unpickler_find_class__doc__}, static PyObject * _pickle_Unpickler_find_class_impl(UnpicklerObject *self, @@ -207,17 +207,21 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, PyObject *global_name); static PyObject * -_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject *args) +_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *module_name; PyObject *global_name; - if (!PyArg_UnpackTuple(args, "find_class", + if (!_PyArg_UnpackStack(args, nargs, "find_class", 2, 2, &module_name, &global_name)) { goto exit; } + + if (!_PyArg_NoStackKeywords("find_class", kwnames)) { + goto exit; + } return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name); exit: @@ -560,4 +564,4 @@ _pickle_loads(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn exit: return return_value; } -/*[clinic end generated code: output=d7222d1219039fbd input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b921d325b2f7a096 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h index 39b2e27..fcb23e8 100644 --- a/Modules/clinic/_sre.c.h +++ b/Modules/clinic/_sre.c.h @@ -551,23 +551,27 @@ PyDoc_STRVAR(_sre_SRE_Match_start__doc__, "Return index of the start of the substring matched by group."); #define _SRE_SRE_MATCH_START_METHODDEF \ - {"start", (PyCFunction)_sre_SRE_Match_start, METH_VARARGS, _sre_SRE_Match_start__doc__}, + {"start", (PyCFunction)_sre_SRE_Match_start, METH_FASTCALL, _sre_SRE_Match_start__doc__}, static Py_ssize_t _sre_SRE_Match_start_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_start(MatchObject *self, PyObject *args) +_sre_SRE_Match_start(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; Py_ssize_t _return_value; - if (!PyArg_UnpackTuple(args, "start", + if (!_PyArg_UnpackStack(args, nargs, "start", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("start", kwnames)) { + goto exit; + } _return_value = _sre_SRE_Match_start_impl(self, group); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -585,23 +589,27 @@ PyDoc_STRVAR(_sre_SRE_Match_end__doc__, "Return index of the end of the substring matched by group."); #define _SRE_SRE_MATCH_END_METHODDEF \ - {"end", (PyCFunction)_sre_SRE_Match_end, METH_VARARGS, _sre_SRE_Match_end__doc__}, + {"end", (PyCFunction)_sre_SRE_Match_end, METH_FASTCALL, _sre_SRE_Match_end__doc__}, static Py_ssize_t _sre_SRE_Match_end_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_end(MatchObject *self, PyObject *args) +_sre_SRE_Match_end(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; Py_ssize_t _return_value; - if (!PyArg_UnpackTuple(args, "end", + if (!_PyArg_UnpackStack(args, nargs, "end", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("end", kwnames)) { + goto exit; + } _return_value = _sre_SRE_Match_end_impl(self, group); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -619,22 +627,26 @@ PyDoc_STRVAR(_sre_SRE_Match_span__doc__, "For MatchObject m, return the 2-tuple (m.start(group), m.end(group))."); #define _SRE_SRE_MATCH_SPAN_METHODDEF \ - {"span", (PyCFunction)_sre_SRE_Match_span, METH_VARARGS, _sre_SRE_Match_span__doc__}, + {"span", (PyCFunction)_sre_SRE_Match_span, METH_FASTCALL, _sre_SRE_Match_span__doc__}, static PyObject * _sre_SRE_Match_span_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_span(MatchObject *self, PyObject *args) +_sre_SRE_Match_span(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; - if (!PyArg_UnpackTuple(args, "span", + if (!_PyArg_UnpackStack(args, nargs, "span", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("span", kwnames)) { + goto exit; + } return_value = _sre_SRE_Match_span_impl(self, group); exit: @@ -720,4 +732,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored)) { return _sre_SRE_Scanner_search_impl(self); } -/*[clinic end generated code: output=3dff18d3b6110b86 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5df18da8e2dc762c input=a9049054013a1b77]*/ diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h index 776dcba..9e16f32 100644 --- a/Modules/clinic/signalmodule.c.h +++ b/Modules/clinic/signalmodule.c.h @@ -353,24 +353,28 @@ PyDoc_STRVAR(signal_sigtimedwait__doc__, "The timeout is specified in seconds, with floating point numbers allowed."); #define SIGNAL_SIGTIMEDWAIT_METHODDEF \ - {"sigtimedwait", (PyCFunction)signal_sigtimedwait, METH_VARARGS, signal_sigtimedwait__doc__}, + {"sigtimedwait", (PyCFunction)signal_sigtimedwait, METH_FASTCALL, signal_sigtimedwait__doc__}, static PyObject * signal_sigtimedwait_impl(PyObject *module, PyObject *sigset, PyObject *timeout_obj); static PyObject * -signal_sigtimedwait(PyObject *module, PyObject *args) +signal_sigtimedwait(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *sigset; PyObject *timeout_obj; - if (!PyArg_UnpackTuple(args, "sigtimedwait", + if (!_PyArg_UnpackStack(args, nargs, "sigtimedwait", 2, 2, &sigset, &timeout_obj)) { goto exit; } + + if (!_PyArg_NoStackKeywords("sigtimedwait", kwnames)) { + goto exit; + } return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj); exit: @@ -459,4 +463,4 @@ exit: #ifndef SIGNAL_PTHREAD_KILL_METHODDEF #define SIGNAL_PTHREAD_KILL_METHODDEF #endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */ -/*[clinic end generated code: output=b49f7bfff44d1256 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fab3dba32c058588 input=a9049054013a1b77]*/ |