]> granicus.if.org Git - python/commitdiff
http://bugs.python.org/issue5552
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Tue, 24 Mar 2009 14:15:49 +0000 (14:15 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Tue, 24 Mar 2009 14:15:49 +0000 (14:15 +0000)
Return None rather than raise an exception if os.device_error is given an invalid file descriptor.

Modules/posixmodule.c

index 4731b81aa74380955b80c38ebc5e57e4740e0f39..1d1e299bbcaa460bfa79c2a8f904a75f486e0968 100644 (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;
        }