summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-30 18:36:44 (GMT)
committerGuido van Rossum <guido@python.org>2007-10-30 18:36:44 (GMT)
commitc6ecfcd87655da599c8662e457f5e7a3c5408c9a (patch)
tree6513faeffe52b95f5a3218154f8ae5c76af86b88 /Objects
parent826d8973ac52a0a8155ef857c8a9bf18a90b11ac (diff)
downloadcpython-c6ecfcd87655da599c8662e457f5e7a3c5408c9a.zip
cpython-c6ecfcd87655da599c8662e457f5e7a3c5408c9a.tar.gz
cpython-c6ecfcd87655da599c8662e457f5e7a3c5408c9a.tar.bz2
Minor correction to the stdprinter object.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/fileobject.c6
1 files 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;
}