mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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
1 changed files with 1 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue