summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-02-19 20:53:06 (GMT)
committerGuido van Rossum <guido@python.org>1998-02-19 20:53:06 (GMT)
commitbd36dbaaa53929e1bd8609e734c7a0fa128b7bd2 (patch)
tree64453bf7a735419d71f106297af031f6c44461ac
parentf1dc0615e913fd0028a2fa6fda9607b3edfa76d5 (diff)
downloadcpython-bd36dbaaa53929e1bd8609e734c7a0fa128b7bd2.zip
cpython-bd36dbaaa53929e1bd8609e734c7a0fa128b7bd2.tar.gz
cpython-bd36dbaaa53929e1bd8609e734c7a0fa128b7bd2.tar.bz2
Make backup copies of stdin, stdout, stderr as __stdin__, __stdout__,
__stderr__. These will be used by the import cleanup.
-rw-r--r--Python/sysmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 665d17c..b3bb919 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);