summaryrefslogtreecommitdiffstats
path: root/Modules/termios.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/termios.c')
-rw-r--r--Modules/termios.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/Modules/termios.c b/Modules/termios.c
index c53566c..0707ad9 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -101,11 +101,11 @@ termios_tcgetattr(PyObject *self, PyObject *args)
MIN and TIME slots are the same as the EOF and EOL slots. So we
only do this in noncanonical input mode. */
if ((mode.c_lflag & ICANON) == 0) {
- v = PyInt_FromLong((long)mode.c_cc[VMIN]);
+ v = PyLong_FromLong((long)mode.c_cc[VMIN]);
if (v == NULL)
goto err;
PyList_SetItem(cc, VMIN, v);
- v = PyInt_FromLong((long)mode.c_cc[VTIME]);
+ v = PyLong_FromLong((long)mode.c_cc[VTIME]);
if (v == NULL)
goto err;
PyList_SetItem(cc, VTIME, v);
@@ -114,12 +114,12 @@ termios_tcgetattr(PyObject *self, PyObject *args)
if (!(v = PyList_New(7)))
goto err;
- PyList_SetItem(v, 0, PyInt_FromLong((long)mode.c_iflag));
- PyList_SetItem(v, 1, PyInt_FromLong((long)mode.c_oflag));
- PyList_SetItem(v, 2, PyInt_FromLong((long)mode.c_cflag));
- PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag));
- PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed));
- PyList_SetItem(v, 5, PyInt_FromLong((long)ospeed));
+ PyList_SetItem(v, 0, PyLong_FromLong((long)mode.c_iflag));
+ PyList_SetItem(v, 1, PyLong_FromLong((long)mode.c_oflag));
+ PyList_SetItem(v, 2, PyLong_FromLong((long)mode.c_cflag));
+ PyList_SetItem(v, 3, PyLong_FromLong((long)mode.c_lflag));
+ PyList_SetItem(v, 4, PyLong_FromLong((long)ispeed));
+ PyList_SetItem(v, 5, PyLong_FromLong((long)ospeed));
PyList_SetItem(v, 6, cc);
if (PyErr_Occurred()){
Py_DECREF(v);
@@ -163,12 +163,12 @@ termios_tcsetattr(PyObject *self, PyObject *args)
/* Get the old mode, in case there are any hidden fields... */
if (tcgetattr(fd, &mode) == -1)
return PyErr_SetFromErrno(TermiosError);
- mode.c_iflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 0));
- mode.c_oflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 1));
- mode.c_cflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 2));
- mode.c_lflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 3));
- ispeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 4));
- ospeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 5));
+ mode.c_iflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 0));
+ mode.c_oflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 1));
+ mode.c_cflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 2));
+ mode.c_lflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 3));
+ ispeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 4));
+ ospeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 5));
cc = PyList_GetItem(term, 6);
if (PyErr_Occurred())
return NULL;
@@ -185,8 +185,8 @@ 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))
- mode.c_cc[i] = (cc_t) PyInt_AsLong(v);
+ else if (PyLong_Check(v))
+ mode.c_cc[i] = (cc_t) PyLong_AsLong(v);
else {
PyErr_SetString(PyExc_TypeError,
"tcsetattr: elements of attributes must be characters or integers");