Commit c6ecfcd8 authored by Guido van Rossum's avatar Guido van Rossum

Minor correction to the stdprinter object.

parent 826d8973
...@@ -352,14 +352,16 @@ PyFile_NewStdPrinter(int fd) ...@@ -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);
if (self != NULL) {
self->fd = fd; self->fd = fd;
}
return (PyObject*)self; return (PyObject*)self;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment