From: Kristján Valur Jónsson Date: Tue, 24 Mar 2009 14:15:49 +0000 (+0000) Subject: http://bugs.python.org/issue5552 X-Git-Tag: v3.1a2~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=649170bd66e0084f227b55a6941c41e0c4d79df7;p=thirdparty%2FPython%2Fcpython.git http://bugs.python.org/issue5552 Return None rather than raise an exception if os.device_error is given an invalid file descriptor. --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 4731b81aa743..1d1e299bbcaa 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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; }