Return None rather than raise an exception if os.device_error is given an invalid file descriptor.
This commit is contained in:
Kristján Valur Jónsson 2009-03-24 14:15:49 +00:00
parent 8915e0e43a
commit 649170bd66

View File

@ -6830,9 +6830,7 @@ device_encoding(PyObject *self, PyObject *args)
int fd;
if (!PyArg_ParseTuple(args, "i:device_encoding", &fd))
return NULL;
if (!_PyVerify_fd(fd))
return posix_error();
if (!isatty(fd)) {
if (!_PyVerify_fd(fd) || !isatty(fd)) {
Py_INCREF(Py_None);
return Py_None;
}