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.
This commit is contained in:
Serhiy Storchaka 2022-04-30 13:15:02 +03:00 committed by GitHub
parent 19dca04121
commit a055dac0b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 820 additions and 449 deletions

View file

@ -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]*/