homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients larry, serhiy.storchaka
Date 2015年05月05日.08:37:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1430815045.2.0.940146497778.issue20303@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015年05月05日 08:37:25serhiy.storchakasetrecipients: + serhiy.storchaka, larry
2015年05月05日 08:37:25serhiy.storchakasetmessageid: <1430815045.2.0.940146497778.issue20303@psf.upfronthosting.co.za>
2015年05月05日 08:37:25serhiy.storchakalinkissue20303 messages
2015年05月05日 08:37:24serhiy.storchakacreate

AltStyle によって変換されたページ (->オリジナル) /