summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-06-04 19:40:59 (GMT)
committerGuido van Rossum <guido@python.org>1991-06-04 19:40:59 (GMT)
commit3caa6e35cfd8bc08725c4d669b46d19f301f3f85 (patch)
treea5c1f22befa90577ef8c97e5b0be917de6ea92e2 /Python/sysmodule.c
parent3b06619e1cbb2dfc4da4992bc648304e48af1701 (diff)
downloadcpython-3caa6e35cfd8bc08725c4d669b46d19f301f3f85.zip
cpython-3caa6e35cfd8bc08725c4d669b46d19f301f3f85.tar.gz
cpython-3caa6e35cfd8bc08725c4d669b46d19f301f3f85.tar.bz2
Added fclose to newopenfileobject() calls.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 35550ad..e66223e 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -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);