Minor correction to the stdprinter object.
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 @@
 {
 	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;
 }