From c6ecfcd87655da599c8662e457f5e7a3c5408c9a Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 30 Oct 2007 18:36:44 +0000 Subject: Minor correction to the stdprinter object. --- Objects/fileobject.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Objects/fileobject.c b/Objects/fileobject.c index dc0f1fd..97c2756 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -352,14 +352,16 @@ PyFile_NewStdPrinter(int fd) { PyStdPrinter_Object *self; - if (fd != 1 && fd != 2) { + if (fd != fileno(stdout) && fd != fileno(stderr)) { PyErr_BadInternalCall(); return NULL; } self = PyObject_New(PyStdPrinter_Object, &PyStdPrinter_Type); - self->fd = fd; + if (self != NULL) { + self->fd = fd; + } return (PyObject*)self; } -- cgit v0.12