From 994f04dbf576f4ebafb9de2bc6821e15cb0de0ea Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 27 Dec 2016 15:09:36 +0200 Subject: Issue #28998: More APIs now support longs as well as ints. --- Modules/termios.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Modules/termios.c') diff --git a/Modules/termios.c b/Modules/termios.c index 57f30dc4cd..9d4d780dca 100644 --- a/Modules/termios.c +++ b/Modules/termios.c @@ -185,8 +185,11 @@ termios_tcsetattr(PyObject *self, PyObject *args) if (PyString_Check(v) && PyString_Size(v) == 1) mode.c_cc[i] = (cc_t) * PyString_AsString(v); - else if (PyInt_Check(v)) + else if (PyInt_Check(v) || PyLong_Check(v)) { mode.c_cc[i] = (cc_t) PyInt_AsLong(v); + if (mode.c_cc[i] == (cc_t) -1 && PyErr_Occurred()) + return NULL; + } else { PyErr_SetString(PyExc_TypeError, "tcsetattr: elements of attributes must be characters or integers"); -- cgit v1.2.1