mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
Minor correction to the stdprinter object.
This commit is contained in:
parent
826d8973ac
commit
c6ecfcd876
1 changed files with 4 additions and 2 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue