diff Python/sysmodule.c @ 7402:c7454ca7d3ac legacy-trunk

Make backup copies of stdin, stdout, stderr as __stdin__, __stdout__, __stderr__. These will be used by the import cleanup.
author Guido van Rossum <guido@python.org>
date Thu, 19 Feb 1998 20:53:06 +0000
parents f406ec35bfca
children f94d5ae642a9
line wrap: on
line diff
--- a/Python/sysmodule.c	Thu Feb 19 20:51:52 1998 +0000
+++ b/Python/sysmodule.c	Thu Feb 19 20:53:06 1998 +0000
@@ -289,6 +289,10 @@
 	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);