mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Added fclose to newopenfileobject() calls.
This commit is contained in:
parent
3b06619e1c
commit
3caa6e35cf
1 changed files with 4 additions and 4 deletions
|
@ -114,15 +114,15 @@ static object *sysin, *sysout, *syserr;
|
||||||
void
|
void
|
||||||
initsys()
|
initsys()
|
||||||
{
|
{
|
||||||
|
extern int fclose PROTO((FILE *));
|
||||||
object *m = initmodule("sys", sys_methods);
|
object *m = initmodule("sys", sys_methods);
|
||||||
sysdict = getmoduledict(m);
|
sysdict = getmoduledict(m);
|
||||||
INCREF(sysdict);
|
INCREF(sysdict);
|
||||||
/* NB keep an extra ref to the std files to avoid closing them
|
/* NB keep an extra ref to the std files to avoid closing them
|
||||||
when the user deletes them */
|
when the user deletes them */
|
||||||
/* XXX File objects should have a "don't close" flag instead */
|
sysin = newopenfileobject(stdin, "<stdin>", "r", fclose);
|
||||||
sysin = newopenfileobject(stdin, "<stdin>", "r");
|
sysout = newopenfileobject(stdout, "<stdout>", "w", fclose);
|
||||||
sysout = newopenfileobject(stdout, "<stdout>", "w");
|
syserr = newopenfileobject(stderr, "<stderr>", "w", fclose);
|
||||||
syserr = newopenfileobject(stderr, "<stderr>", "w");
|
|
||||||
if (err_occurred())
|
if (err_occurred())
|
||||||
fatal("can't create sys.std* file objects");
|
fatal("can't create sys.std* file objects");
|
||||||
dictinsert(sysdict, "stdin", sysin);
|
dictinsert(sysdict, "stdin", sysin);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue