Skip to content

gh-111178: Generate correct signature for most self converters #128447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4758,7 +4758,7 @@ static PyObject *
Test_cls_with_param_impl(TestObj *self, PyTypeObject *cls, int a);

static PyObject *
Test_cls_with_param(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
Test_cls_with_param(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
Expand Down Expand Up @@ -4798,15 +4798,15 @@ Test_cls_with_param(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_
if (a == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = Test_cls_with_param_impl(self, cls, a);
return_value = Test_cls_with_param_impl((TestObj *)self, cls, a);

exit:
return return_value;
}

static PyObject *
Test_cls_with_param_impl(TestObj *self, PyTypeObject *cls, int a)
/*[clinic end generated code: output=83a391eea66d08f8 input=af158077bd237ef9]*/
/*[clinic end generated code: output=7e893134a81fef92 input=af158077bd237ef9]*/


/*[clinic input]
Expand Down Expand Up @@ -4908,18 +4908,18 @@ static PyObject *
Test_cls_no_params_impl(TestObj *self, PyTypeObject *cls);

static PyObject *
Test_cls_no_params(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
Test_cls_no_params(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "cls_no_params() takes no arguments");
return NULL;
}
return Test_cls_no_params_impl(self, cls);
return Test_cls_no_params_impl((TestObj *)self, cls);
}

static PyObject *
Test_cls_no_params_impl(TestObj *self, PyTypeObject *cls)
/*[clinic end generated code: output=4d68b4652c144af3 input=e7e2e4e344e96a11]*/
/*[clinic end generated code: output=8845de054449f40a input=e7e2e4e344e96a11]*/


/*[clinic input]
Expand All @@ -4945,7 +4945,7 @@ Test_metho_not_default_return_converter(TestObj *self, PyObject *a)
PyObject *return_value = NULL;
int _return_value;

_return_value = Test_metho_not_default_return_converter_impl(self, a);
_return_value = Test_metho_not_default_return_converter_impl((TestObj *)self, a);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
Expand All @@ -4957,7 +4957,7 @@ Test_metho_not_default_return_converter(TestObj *self, PyObject *a)

static int
Test_metho_not_default_return_converter_impl(TestObj *self, PyObject *a)
/*[clinic end generated code: output=3350de11bd538007 input=428657129b521177]*/
/*[clinic end generated code: output=b2cce75a7af2e6ce input=428657129b521177]*/


/*[clinic input]
Expand All @@ -4983,7 +4983,7 @@ static PyObject *
Test_an_metho_arg_named_arg_impl(TestObj *self, int arg);

static PyObject *
Test_an_metho_arg_named_arg(TestObj *self, PyObject *arg_)
Test_an_metho_arg_named_arg(PyObject *self, PyObject *arg_)
{
PyObject *return_value = NULL;
int arg;
Expand All @@ -4992,15 +4992,15 @@ Test_an_metho_arg_named_arg(TestObj *self, PyObject *arg_)
if (arg == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = Test_an_metho_arg_named_arg_impl(self, arg);
return_value = Test_an_metho_arg_named_arg_impl((TestObj *)self, arg);

exit:
return return_value;
}

static PyObject *
Test_an_metho_arg_named_arg_impl(TestObj *self, int arg)
/*[clinic end generated code: output=9f04de4a62287e28 input=2a53a57cf5624f95]*/
/*[clinic end generated code: output=38554f09950d07e7 input=2a53a57cf5624f95]*/


/*[clinic input]
Expand Down Expand Up @@ -5289,14 +5289,14 @@ static PyObject *
Test_meth_coexist_impl(TestObj *self);

static PyObject *
Test_meth_coexist(TestObj *self, PyObject *Py_UNUSED(ignored))
Test_meth_coexist(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return Test_meth_coexist_impl(self);
return Test_meth_coexist_impl((TestObj *)self);
}

static PyObject *
Test_meth_coexist_impl(TestObj *self)
/*[clinic end generated code: output=808a293d0cd27439 input=2a1d75b5e6fec6dd]*/
/*[clinic end generated code: output=7edf4e95b29f06fa input=2a1d75b5e6fec6dd]*/

/*[clinic input]
@getter
Expand All @@ -5317,14 +5317,14 @@ static PyObject *
Test_property_get_impl(TestObj *self);

static PyObject *
Test_property_get(TestObj *self, void *Py_UNUSED(context))
Test_property_get(PyObject *self, void *Py_UNUSED(context))
{
return Test_property_get_impl(self);
return Test_property_get_impl((TestObj *)self);
}

static PyObject *
Test_property_get_impl(TestObj *self)
/*[clinic end generated code: output=7cadd0f539805266 input=2d92b3449fbc7d2b]*/
/*[clinic end generated code: output=b38d68abd3466a6e input=2d92b3449fbc7d2b]*/

/*[clinic input]
@setter
Expand All @@ -5345,18 +5345,18 @@ static int
Test_property_set_impl(TestObj *self, PyObject *value);

static int
Test_property_set(TestObj *self, PyObject *value, void *Py_UNUSED(context))
Test_property_set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
{
int return_value;

return_value = Test_property_set_impl(self, value);
return_value = Test_property_set_impl((TestObj *)self, value);

return return_value;
}

static int
Test_property_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=e4342fe9bb1d7817 input=3bc3f46a23c83a88]*/
/*[clinic end generated code: output=49f925ab2a33b637 input=3bc3f46a23c83a88]*/

/*[clinic input]
@setter
Expand All @@ -5377,18 +5377,18 @@ static int
Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value);

static int
Test_setter_first_with_docstr_set(TestObj *self, PyObject *value, void *Py_UNUSED(context))
Test_setter_first_with_docstr_set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
{
int return_value;

return_value = Test_setter_first_with_docstr_set_impl(self, value);
return_value = Test_setter_first_with_docstr_set_impl((TestObj *)self, value);

return return_value;
}

static int
Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=e4d76b558a4061db input=31a045ce11bbe961]*/
/*[clinic end generated code: output=5aaf44373c0af545 input=31a045ce11bbe961]*/

/*[clinic input]
@getter
Expand Down Expand Up @@ -5418,14 +5418,14 @@ static PyObject *
Test_setter_first_with_docstr_get_impl(TestObj *self);

static PyObject *
Test_setter_first_with_docstr_get(TestObj *self, void *Py_UNUSED(context))
Test_setter_first_with_docstr_get(PyObject *self, void *Py_UNUSED(context))
{
return Test_setter_first_with_docstr_get_impl(self);
return Test_setter_first_with_docstr_get_impl((TestObj *)self);
}

static PyObject *
Test_setter_first_with_docstr_get_impl(TestObj *self)
/*[clinic end generated code: output=749a30266f9fb443 input=10af4e43b3cb34dc]*/
/*[clinic end generated code: output=fe6e3aa844a24920 input=10af4e43b3cb34dc]*/

/*[clinic input]
output push
Expand Down Expand Up @@ -5708,7 +5708,7 @@ Test__pyarg_parsestackandkeywords_impl(TestObj *self, PyTypeObject *cls,
Py_ssize_t key_length);

static PyObject *
Test__pyarg_parsestackandkeywords(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
Test__pyarg_parsestackandkeywords(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
Expand All @@ -5731,7 +5731,7 @@ Test__pyarg_parsestackandkeywords(TestObj *self, PyTypeObject *cls, PyObject *co
&key, &key_length)) {
goto exit;
}
return_value = Test__pyarg_parsestackandkeywords_impl(self, cls, key, key_length);
return_value = Test__pyarg_parsestackandkeywords_impl((TestObj *)self, cls, key, key_length);

exit:
return return_value;
Expand All @@ -5741,7 +5741,7 @@ static PyObject *
Test__pyarg_parsestackandkeywords_impl(TestObj *self, PyTypeObject *cls,
const char *key,
Py_ssize_t key_length)
/*[clinic end generated code: output=4fda8a7f2547137c input=fc72ef4b4cfafabc]*/
/*[clinic end generated code: output=7060c213d7b8200e input=fc72ef4b4cfafabc]*/


/*[clinic input]
Expand Down
30 changes: 15 additions & 15 deletions Modules/_ctypes/clinic/_ctypes.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4947,7 +4947,7 @@ datetime.time.replace
minute: int(c_default="TIME_GET_MINUTE(self)") = unchanged
second: int(c_default="TIME_GET_SECOND(self)") = unchanged
microsecond: int(c_default="TIME_GET_MICROSECOND(self)") = unchanged
tzinfo: object(c_default="HASTZINFO(self) ? self->tzinfo : Py_None") = unchanged
tzinfo: object(c_default="HASTZINFO(self) ? ((PyDateTime_Time *)self)->tzinfo : Py_None") = unchanged
*
fold: int(c_default="TIME_GET_FOLD(self)") = unchanged

Expand All @@ -4958,7 +4958,7 @@ static PyObject *
datetime_time_replace_impl(PyDateTime_Time *self, int hour, int minute,
int second, int microsecond, PyObject *tzinfo,
int fold)
/*[clinic end generated code: output=0b89a44c299e4f80 input=9b6a35b1e704b0ca]*/
/*[clinic end generated code: output=0b89a44c299e4f80 input=abf23656e8df4e97]*/
{
return new_time_subclass_fold_ex(hour, minute, second, microsecond, tzinfo,
fold, (PyObject *)Py_TYPE(self));
Expand Down Expand Up @@ -6449,7 +6449,7 @@ datetime.datetime.replace
minute: int(c_default="DATE_GET_MINUTE(self)") = unchanged
second: int(c_default="DATE_GET_SECOND(self)") = unchanged
microsecond: int(c_default="DATE_GET_MICROSECOND(self)") = unchanged
tzinfo: object(c_default="HASTZINFO(self) ? self->tzinfo : Py_None") = unchanged
tzinfo: object(c_default="HASTZINFO(self) ? ((PyDateTime_DateTime *)self)->tzinfo : Py_None") = unchanged
*
fold: int(c_default="DATE_GET_FOLD(self)") = unchanged

Expand All @@ -6461,7 +6461,7 @@ datetime_datetime_replace_impl(PyDateTime_DateTime *self, int year,
int month, int day, int hour, int minute,
int second, int microsecond, PyObject *tzinfo,
int fold)
/*[clinic end generated code: output=00bc96536833fddb input=9b38253d56d9bcad]*/
/*[clinic end generated code: output=00bc96536833fddb input=fd972762d604d3e7]*/
{
return new_datetime_subclass_fold_ex(year, month, day, hour, minute,
second, microsecond, tzinfo, fold,
Expand Down
4 changes: 2 additions & 2 deletions Modules/_io/bytesio.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ _io_BytesIO_readinto_impl(bytesio *self, Py_buffer *buffer)

/*[clinic input]
_io.BytesIO.truncate
size: Py_ssize_t(accept={int, NoneType}, c_default="self->pos") = None
size: Py_ssize_t(accept={int, NoneType}, c_default="((bytesio *)self)->pos") = None
/

Truncate the file to at most size bytes.
Expand All @@ -599,7 +599,7 @@ The current file position is unchanged. Returns the new size.

static PyObject *
_io_BytesIO_truncate_impl(bytesio *self, Py_ssize_t size)
/*[clinic end generated code: output=9ad17650c15fa09b input=423759dd42d2f7c1]*/
/*[clinic end generated code: output=9ad17650c15fa09b input=dae4295e11c1bbb4]*/
{
CHECK_CLOSED(self);
CHECK_EXPORTS(self);
Expand Down
Loading
Loading