diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2022-04-30 10:15:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-30 10:15:02 (GMT) |
commit | a055dac0b45031878a8196a8735522de018491e3 (patch) | |
tree | 5228f98a9ce93456c5d3db84a3fed0096b8f0f38 /Modules/cjkcodecs | |
parent | 19dca041212f9f58ee11833bff3f8c157d4fd3e8 (diff) | |
download | cpython-a055dac0b45031878a8196a8735522de018491e3.zip cpython-a055dac0b45031878a8196a8735522de018491e3.tar.gz cpython-a055dac0b45031878a8196a8735522de018491e3.tar.bz2 |
gh-91583: AC: Fix regression for functions with defining_class (GH-91739)
Argument Clinic now generates the same efficient code as before
adding the defining_class parameter.
Diffstat (limited to 'Modules/cjkcodecs')
-rw-r--r-- | Modules/cjkcodecs/clinic/multibytecodec.c.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h index 1dfb9a1..6051524 100644 --- a/Modules/cjkcodecs/clinic/multibytecodec.c.h +++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h @@ -493,13 +493,15 @@ _multibytecodec_MultibyteStreamWriter_write(MultibyteStreamWriterObject *self, P { PyObject *return_value = NULL; static const char * const _keywords[] = {"", NULL}; - static _PyArg_Parser _parser = {"O:write", _keywords, 0}; + static _PyArg_Parser _parser = {NULL, _keywords, "write", 0}; + PyObject *argsbuf[1]; PyObject *strobj; - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &strobj)) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); + if (!args) { goto exit; } + strobj = args[0]; return_value = _multibytecodec_MultibyteStreamWriter_write_impl(self, cls, strobj); exit: @@ -524,13 +526,15 @@ _multibytecodec_MultibyteStreamWriter_writelines(MultibyteStreamWriterObject *se { PyObject *return_value = NULL; static const char * const _keywords[] = {"", NULL}; - static _PyArg_Parser _parser = {"O:writelines", _keywords, 0}; + static _PyArg_Parser _parser = {NULL, _keywords, "writelines", 0}; + PyObject *argsbuf[1]; PyObject *lines; - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &lines)) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); + if (!args) { goto exit; } + lines = args[0]; return_value = _multibytecodec_MultibyteStreamWriter_writelines_impl(self, cls, lines); exit: @@ -552,18 +556,11 @@ _multibytecodec_MultibyteStreamWriter_reset_impl(MultibyteStreamWriterObject *se static PyObject * _multibytecodec_MultibyteStreamWriter_reset(MultibyteStreamWriterObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { - PyObject *return_value = NULL; - static const char * const _keywords[] = { NULL}; - static _PyArg_Parser _parser = {":reset", _keywords, 0}; - - if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser - )) { - goto exit; + if (nargs) { + PyErr_SetString(PyExc_TypeError, "reset() takes no arguments"); + return NULL; } - return_value = _multibytecodec_MultibyteStreamWriter_reset_impl(self, cls); - -exit: - return return_value; + return _multibytecodec_MultibyteStreamWriter_reset_impl(self, cls); } PyDoc_STRVAR(_multibytecodec___create_codec__doc__, @@ -573,4 +570,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__, #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \ {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__}, -/*[clinic end generated code: output=8813c05077580bda input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0ee00c9f6883afe9 input=a9049054013a1b77]*/ |