mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +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;
|
int fd;
|
||||||
if (!PyArg_ParseTuple(args, "i:device_encoding", &fd))
|
if (!PyArg_ParseTuple(args, "i:device_encoding", &fd))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!_PyVerify_fd(fd))
|
if (!_PyVerify_fd(fd) || !isatty(fd)) {
|
||||||
return posix_error();
|
|
||||||
if (!isatty(fd)) {
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue