From 649170bd66e0084f227b55a6941c41e0c4d79df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Tue, 24 Mar 2009 14:15:49 +0000 Subject: [PATCH] http://bugs.python.org/issue5552 Return None rather than raise an exception if os.device_error is given an invalid file descriptor. --- Modules/posixmodule.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 4731b81aa74..1d1e299bbca 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; }