Issue #28998: More APIs now support longs as well as ints.
diff --git a/Modules/termios.c b/Modules/termios.c
index 57f30dc..9d4d780 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -185,8 +185,11 @@
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");