From: Guido van Rossum Date: Tue, 30 Oct 2007 18:36:44 +0000 (+0000) Subject: Minor correction to the stdprinter object. X-Git-Tag: v3.0a2~249 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c6ecfcd87655da599c8662e457f5e7a3c5408c9a;p=thirdparty%2FPython%2Fcpython.git Minor correction to the stdprinter object. --- diff --git a/Objects/fileobject.c b/Objects/fileobject.c index dc0f1fd14733..97c2756ac4d6 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; }