mirror of https://github.com/python/cpython
Return None rather than raise an exception if os.device_error is given an invalid file descriptor.
This commit is contained in:
parent
8915e0e43a
commit
649170bd66
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue