Minor correction to the stdprinter object.

This commit is contained in:
Guido van Rossum 2007-10-30 18:36:44 +00:00
parent 826d8973ac
commit c6ecfcd876

View File

@ -352,14 +352,16 @@ PyFile_NewStdPrinter(int fd)
{ {
PyStdPrinter_Object *self; PyStdPrinter_Object *self;
if (fd != 1 && fd != 2) { if (fd != fileno(stdout) && fd != fileno(stderr)) {
PyErr_BadInternalCall(); PyErr_BadInternalCall();
return NULL; return NULL;
} }
self = PyObject_New(PyStdPrinter_Object, self = PyObject_New(PyStdPrinter_Object,
&PyStdPrinter_Type); &PyStdPrinter_Type);
self->fd = fd; if (self != NULL) {
self->fd = fd;
}
return (PyObject*)self; return (PyObject*)self;
} }