mirror of https://github.com/python/cpython
Fix bug #417212: "curses.newwin can return pads" by changing the Python
newwin() wrapper to always return a window, and never a pad. This makes the code match the documentation.
This commit is contained in:
parent
9eb27a89d8
commit
5a76c44181
|
@ -2051,7 +2051,7 @@ static PyObject *
|
||||||
PyCurses_NewWindow(PyObject *self, PyObject *args)
|
PyCurses_NewWindow(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
WINDOW *win;
|
WINDOW *win;
|
||||||
int nlines, ncols, begin_y, begin_x;
|
int nlines, ncols, begin_y=0, begin_x=0;
|
||||||
|
|
||||||
PyCursesInitialised
|
PyCursesInitialised
|
||||||
|
|
||||||
|
@ -2059,19 +2059,18 @@ PyCurses_NewWindow(PyObject *self, PyObject *args)
|
||||||
case 2:
|
case 2:
|
||||||
if (!PyArg_Parse(args,"(ii);nlines,ncols",&nlines,&ncols))
|
if (!PyArg_Parse(args,"(ii);nlines,ncols",&nlines,&ncols))
|
||||||
return NULL;
|
return NULL;
|
||||||
win = newpad(nlines, ncols);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (!PyArg_Parse(args, "(iiii);nlines,ncols,begin_y,begin_x",
|
if (!PyArg_Parse(args, "(iiii);nlines,ncols,begin_y,begin_x",
|
||||||
&nlines,&ncols,&begin_y,&begin_x))
|
&nlines,&ncols,&begin_y,&begin_x))
|
||||||
return NULL;
|
return NULL;
|
||||||
win = newwin(nlines,ncols,begin_y,begin_x);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PyErr_SetString(PyExc_TypeError, "newwin requires 2 or 4 arguments");
|
PyErr_SetString(PyExc_TypeError, "newwin requires 2 or 4 arguments");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
win = newwin(nlines,ncols,begin_y,begin_x);
|
||||||
if (win == NULL) {
|
if (win == NULL) {
|
||||||
PyErr_SetString(PyCursesError, catchall_NULL);
|
PyErr_SetString(PyCursesError, catchall_NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue