Skip to content
Open
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
44 changes: 14 additions & 30 deletions Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2566,18 +2566,14 @@ test_keywords_opt_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nar
}
a = args[0];
if (!noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
if (args[1]) {
b = args[1];
if (!--noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[2]) {
c = args[2];
if (!--noptargs) {
Expand All @@ -2595,7 +2591,7 @@ test_keywords_opt_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nar
static PyObject *
test_keywords_opt_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
PyObject *c, PyObject *d)
/*[clinic end generated code: output=1e5fbe4eebfd40a5 input=209387a4815e5082]*/
/*[clinic end generated code: output=4975a8d3cc3dd537 input=209387a4815e5082]*/


/*[clinic input]
Expand Down Expand Up @@ -3728,18 +3724,14 @@ test_posonly_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py
a = args[0];
b = args[1];
if (!noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
if (args[2]) {
c = args[2];
if (!--noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[3]) {
d = args[3];
if (!--noptargs) {
Expand All @@ -3758,7 +3750,7 @@ static PyObject *
test_posonly_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
PyObject *b, PyObject *c,
PyObject *d, PyObject *e)
/*[clinic end generated code: output=bcb0088555123966 input=d0883d45876f186c]*/
/*[clinic end generated code: output=6da0b1784bc3b72a input=d0883d45876f186c]*/


/*[clinic input]
Expand Down Expand Up @@ -3834,24 +3826,20 @@ test_posonly_keywords_opt2_kwonly_opt(PyObject *module, PyObject *const *args, P
}
a = args[0];
if (!noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
if (args[1]) {
b = args[1];
if (!--noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
}
if (args[2]) {
c = args[2];
if (!--noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[3]) {
d = args[3];
if (!--noptargs) {
Expand All @@ -3870,7 +3858,7 @@ static PyObject *
test_posonly_keywords_opt2_kwonly_opt_impl(PyObject *module, PyObject *a,
PyObject *b, PyObject *c,
PyObject *d, PyObject *e)
/*[clinic end generated code: output=a22d1276d4c2c9c7 input=c95e2e1ec93035ad]*/
/*[clinic end generated code: output=38e66485d62640d5 input=c95e2e1ec93035ad]*/


/*[clinic input]
Expand Down Expand Up @@ -3955,24 +3943,20 @@ test_posonly_opt_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args
b = args[1];
skip_optional_posonly:
if (!noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
if (args[2]) {
c = args[2];
if (!--noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
}
if (args[3]) {
d = args[3];
if (!--noptargs) {
goto skip_optional_pos;
goto skip_optional_kwonly;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[4]) {
e = args[4];
if (!--noptargs) {
Expand All @@ -3992,7 +3976,7 @@ test_posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
PyObject *b, PyObject *c,
PyObject *d, PyObject *e,
PyObject *f)
/*[clinic end generated code: output=ebdbe695ee85a2ea input=9914857713c5bbf8]*/
/*[clinic end generated code: output=f3a7058554e16338 input=9914857713c5bbf8]*/

/*[clinic input]
test_keyword_only_parameter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid generating redundant gotos and labels in Argument Clinic when a function has optional positional arguments and optional keyword-only arguments without required keyword-only arguments.
10 changes: 3 additions & 7 deletions Modules/_decimal/clinic/_decimal.c.h

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

42 changes: 13 additions & 29 deletions Modules/clinic/_bisectmodule.c.h

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

Loading
Loading