merge 3.5

This commit is contained in:
Benjamin Peterson 2016-08-15 21:44:06 -07:00
commit cc2e80be64
3 changed files with 12 additions and 2 deletions

View File

@ -190,6 +190,8 @@ class TestCurses(unittest.TestCase):
self.assertRaises(ValueError, stdscr.getstr, -400) self.assertRaises(ValueError, stdscr.getstr, -400)
self.assertRaises(ValueError, stdscr.getstr, 2, 3, -400) self.assertRaises(ValueError, stdscr.getstr, 2, 3, -400)
self.assertRaises(ValueError, stdscr.instr, -2)
self.assertRaises(ValueError, stdscr.instr, 2, 3, -2)
def test_module_funcs(self): def test_module_funcs(self):

View File

@ -102,8 +102,8 @@ Library
- Issue #27661: Added tzinfo keyword argument to datetime.combine. - Issue #27661: Added tzinfo keyword argument to datetime.combine.
- In the curses module, raise an error if window.getstr() is passed a negative - In the curses module, raise an error if window.getstr() or window.instr() is
value. passed a negative value.
- Issue #27760: Fix possible integer overflow in binascii.b2a_qp. - Issue #27760: Fix possible integer overflow in binascii.b2a_qp.

View File

@ -1393,6 +1393,10 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
case 1: case 1:
if (!PyArg_ParseTuple(args,"i;n", &n)) if (!PyArg_ParseTuple(args,"i;n", &n))
return NULL; return NULL;
if (n < 0) {
PyErr_SetString(PyExc_ValueError, "'n' must be nonnegative");
return NULL;
}
rtn2 = winnstr(self->win, rtn, Py_MIN(n, 1023)); rtn2 = winnstr(self->win, rtn, Py_MIN(n, 1023));
break; break;
case 2: case 2:
@ -1403,6 +1407,10 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
case 3: case 3:
if (!PyArg_ParseTuple(args, "iii;y,x,n", &y, &x, &n)) if (!PyArg_ParseTuple(args, "iii;y,x,n", &y, &x, &n))
return NULL; return NULL;
if (n < 0) {
PyErr_SetString(PyExc_ValueError, "'n' must be nonnegative");
return NULL;
}
rtn2 = mvwinnstr(self->win, y, x, rtn, Py_MIN(n,1023)); rtn2 = mvwinnstr(self->win, y, x, rtn, Py_MIN(n,1023));
break; break;
default: default: