]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added fclose to newopenfileobject() calls.
authorGuido van Rossum <guido@python.org>
Tue, 4 Jun 1991 19:40:59 +0000 (19:40 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 4 Jun 1991 19:40:59 +0000 (19:40 +0000)
Python/sysmodule.c

index 35550ad3641401a725c4b42f630b32f623696b3e..e66223e6f7b725b0db187881da0033e3d0d6dd7e 100644 (file)
@@ -114,15 +114,15 @@ static object *sysin, *sysout, *syserr;
 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);