[Python-3000-checkins] r58720 - python/branches/py3k/Objects/fileobject.c

guido.van.rossum python-3000-checkins at python.org
Tue Oct 30 19:36:44 CET 2007


Author: guido.van.rossum
Date: Tue Oct 30 19:36:44 2007
New Revision: 58720

Modified:
   python/branches/py3k/Objects/fileobject.c
Log:
Minor correction to the stdprinter object.


Modified: python/branches/py3k/Objects/fileobject.c
==============================================================================
--- python/branches/py3k/Objects/fileobject.c	(original)
+++ python/branches/py3k/Objects/fileobject.c	Tue Oct 30 19:36:44 2007
@@ -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;
 }
 


More information about the Python-3000-checkins mailing list