From: Guido van Rossum Date: Thu, 19 Feb 1998 20:53:06 +0000 (+0000) Subject: Make backup copies of stdin, stdout, stderr as __stdin__, __stdout__, X-Git-Tag: v1.5.1~652 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd36dbaaa53929e1bd8609e734c7a0fa128b7bd2;p=thirdparty%2FPython%2Fcpython.git Make backup copies of stdin, stdout, stderr as __stdin__, __stdout__, __stderr__. These will be used by the import cleanup. --- diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 665d17c3eb49..b3bb919e007e 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -289,6 +289,10 @@ _PySys_Init() PyDict_SetItemString(sysdict, "stdin", sysin); PyDict_SetItemString(sysdict, "stdout", sysout); PyDict_SetItemString(sysdict, "stderr", syserr); + /* Make backup copies for cleanup */ + PyDict_SetItemString(sysdict, "__stdin__", sysin); + PyDict_SetItemString(sysdict, "__stdout__", sysout); + PyDict_SetItemString(sysdict, "__stderr__", syserr); Py_XDECREF(sysin); Py_XDECREF(sysout); Py_XDECREF(syserr);