From 6ed55b2d31ec9afacbecd309d2c3a4c099848a6c Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 23 Oct 2016 15:12:25 +0300 Subject: Issue #28511: Use the "U" format instead of "O!" in PyArg_Parse*. --- Modules/clinic/unicodedata.c.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Modules/clinic/unicodedata.c.h') diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h index d481ccbe64..e8a73b9c47 100644 --- a/Modules/clinic/unicodedata.c.h +++ b/Modules/clinic/unicodedata.c.h @@ -306,8 +306,8 @@ unicodedata_UCD_normalize(PyObject *self, PyObject *args) const char *form; PyObject *input; - if (!PyArg_ParseTuple(args, "sO!:normalize", - &form, &PyUnicode_Type, &input)) { + if (!PyArg_ParseTuple(args, "sU:normalize", + &form, &input)) { goto exit; } return_value = unicodedata_UCD_normalize_impl(self, form, input); @@ -379,4 +379,4 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=5313ce129da87b2f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=07e93c267323a576 input=a9049054013a1b77]*/ -- cgit v1.2.1 From 7372e18fa83aa35766f8f6fdf3aed27fac2d52d2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 17 Jan 2017 01:35:17 +0100 Subject: Run Argument Clinic: METH_VARARGS=>METH_FASTCALL Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using only positional arguments. --- Modules/clinic/unicodedata.c.h | 52 +++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'Modules/clinic/unicodedata.c.h') diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h index e8a73b9c47..c3a5910b49 100644 --- a/Modules/clinic/unicodedata.c.h +++ b/Modules/clinic/unicodedata.c.h @@ -13,23 +13,27 @@ PyDoc_STRVAR(unicodedata_UCD_decimal__doc__, "ValueError is raised."); #define UNICODEDATA_UCD_DECIMAL_METHODDEF \ - {"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__}, + {"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_FASTCALL, unicodedata_UCD_decimal__doc__}, static PyObject * unicodedata_UCD_decimal_impl(PyObject *self, int chr, PyObject *default_value); static PyObject * -unicodedata_UCD_decimal(PyObject *self, PyObject *args) +unicodedata_UCD_decimal(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int chr; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "C|O:decimal", + if (!_PyArg_ParseStack(args, nargs, "C|O:decimal", &chr, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("decimal", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_decimal_impl(self, chr, default_value); exit: @@ -47,22 +51,26 @@ PyDoc_STRVAR(unicodedata_UCD_digit__doc__, "ValueError is raised."); #define UNICODEDATA_UCD_DIGIT_METHODDEF \ - {"digit", (PyCFunction)unicodedata_UCD_digit, METH_VARARGS, unicodedata_UCD_digit__doc__}, + {"digit", (PyCFunction)unicodedata_UCD_digit, METH_FASTCALL, unicodedata_UCD_digit__doc__}, static PyObject * unicodedata_UCD_digit_impl(PyObject *self, int chr, PyObject *default_value); static PyObject * -unicodedata_UCD_digit(PyObject *self, PyObject *args) +unicodedata_UCD_digit(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int chr; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "C|O:digit", + if (!_PyArg_ParseStack(args, nargs, "C|O:digit", &chr, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("digit", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_digit_impl(self, chr, default_value); exit: @@ -80,23 +88,27 @@ PyDoc_STRVAR(unicodedata_UCD_numeric__doc__, "ValueError is raised."); #define UNICODEDATA_UCD_NUMERIC_METHODDEF \ - {"numeric", (PyCFunction)unicodedata_UCD_numeric, METH_VARARGS, unicodedata_UCD_numeric__doc__}, + {"numeric", (PyCFunction)unicodedata_UCD_numeric, METH_FASTCALL, unicodedata_UCD_numeric__doc__}, static PyObject * unicodedata_UCD_numeric_impl(PyObject *self, int chr, PyObject *default_value); static PyObject * -unicodedata_UCD_numeric(PyObject *self, PyObject *args) +unicodedata_UCD_numeric(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int chr; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "C|O:numeric", + if (!_PyArg_ParseStack(args, nargs, "C|O:numeric", &chr, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("numeric", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_numeric_impl(self, chr, default_value); exit: @@ -293,23 +305,27 @@ PyDoc_STRVAR(unicodedata_UCD_normalize__doc__, "Valid values for form are \'NFC\', \'NFKC\', \'NFD\', and \'NFKD\'."); #define UNICODEDATA_UCD_NORMALIZE_METHODDEF \ - {"normalize", (PyCFunction)unicodedata_UCD_normalize, METH_VARARGS, unicodedata_UCD_normalize__doc__}, + {"normalize", (PyCFunction)unicodedata_UCD_normalize, METH_FASTCALL, unicodedata_UCD_normalize__doc__}, static PyObject * unicodedata_UCD_normalize_impl(PyObject *self, const char *form, PyObject *input); static PyObject * -unicodedata_UCD_normalize(PyObject *self, PyObject *args) +unicodedata_UCD_normalize(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *form; PyObject *input; - if (!PyArg_ParseTuple(args, "sU:normalize", + if (!_PyArg_ParseStack(args, nargs, "sU:normalize", &form, &input)) { goto exit; } + + if (!_PyArg_NoStackKeywords("normalize", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_normalize_impl(self, form, input); exit: @@ -326,22 +342,26 @@ PyDoc_STRVAR(unicodedata_UCD_name__doc__, "ValueError is raised."); #define UNICODEDATA_UCD_NAME_METHODDEF \ - {"name", (PyCFunction)unicodedata_UCD_name, METH_VARARGS, unicodedata_UCD_name__doc__}, + {"name", (PyCFunction)unicodedata_UCD_name, METH_FASTCALL, unicodedata_UCD_name__doc__}, static PyObject * unicodedata_UCD_name_impl(PyObject *self, int chr, PyObject *default_value); static PyObject * -unicodedata_UCD_name(PyObject *self, PyObject *args) +unicodedata_UCD_name(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int chr; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "C|O:name", + if (!_PyArg_ParseStack(args, nargs, "C|O:name", &chr, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("name", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_name_impl(self, chr, default_value); exit: @@ -379,4 +399,4 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=07e93c267323a576 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fcb86aaa3fa40876 input=a9049054013a1b77]*/ -- cgit v1.2.1