Message242590
I tried to make a workaround with using default value instead of optional group, but for the following declaration an incorrect code is generated:
/*[clinic input]
_curses.window.getstr
[
y: int
Y-coordinate.
x: int
X-coordinate.
]
n: int = 1023
/
[clinic start generated code]*/
Generated code is:
static PyObject *
_curses_window_getstr(PyCursesWindowObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int group_left_1 = 0;
int y = 0;
int x = 0;
int n = 1023;
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "i:getstr", &n))
goto exit;
break;
case 3:
if (!PyArg_ParseTuple(args, "iii:getstr", &y, &x, &n))
goto exit;
group_left_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "_curses.window.getstr requires 1 to 3 arguments");
goto exit;
}
return_value = _curses_window_getstr_impl(self, group_left_1, y, x, n);
exit:
return return_value;
}
Expected generated code:
static PyObject *
_curses_window_getstr(PyCursesWindowObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int group_left_1 = 0;
int y = 0;
int x = 0;
int n = 1023;
switch (PyTuple_GET_SIZE(args)) {
case 0:
case 1:
if (!PyArg_ParseTuple(args, "|i:getstr", &n))
goto exit;
break;
case 2:
case 3:
if (!PyArg_ParseTuple(args, "ii|i:getstr", &y, &x, &n))
goto exit;
group_left_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "_curses.window.getstr requires 0 to 3 arguments");
goto exit;
}
return_value = _curses_window_getstr_impl(self, group_left_1, y, x, n);
exit:
return return_value;
}
This bug looks similar to issue24051. |
|
Date |
User |
Action |
Args |
2015-05-05 08:37:25 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, larry |
2015-05-05 08:37:25 | serhiy.storchaka | set | messageid: <1430815045.2.0.940146497778.issue20303@psf.upfronthosting.co.za> |
2015-05-05 08:37:25 | serhiy.storchaka | link | issue20303 messages |
2015-05-05 08:37:24 | serhiy.storchaka | create | |
|