diff Python/sysmodule.c @ 265:187ba1733b17 legacy-trunk

Added fclose to newopenfileobject() calls.
author Guido van Rossum <guido@python.org>
date Tue, 04 Jun 1991 19:40:59 +0000
parents 914c83cfa5e1
children f900b692b37e
line wrap: on
line diff
--- a/Python/sysmodule.c	Tue Jun 04 19:40:25 1991 +0000
+++ b/Python/sysmodule.c	Tue Jun 04 19:40:59 1991 +0000
@@ -114,15 +114,15 @@
 void
 initsys()
 {
+	extern int fclose PROTO((FILE *));
 	object *m = initmodule("sys", sys_methods);
 	sysdict = getmoduledict(m);
 	INCREF(sysdict);
 	/* NB keep an extra ref to the std files to avoid closing them
 	   when the user deletes them */
-	/* XXX File objects should have a "don't close" flag instead */
-	sysin = newopenfileobject(stdin, "<stdin>", "r");
-	sysout = newopenfileobject(stdout, "<stdout>", "w");
-	syserr = newopenfileobject(stderr, "<stderr>", "w");
+	sysin = newopenfileobject(stdin, "<stdin>", "r", fclose);
+	sysout = newopenfileobject(stdout, "<stdout>", "w", fclose);
+	syserr = newopenfileobject(stderr, "<stderr>", "w", fclose);
 	if (err_occurred())
 		fatal("can't create sys.std* file objects");
 	dictinsert(sysdict, "stdin", sysin);