diff Python/pythonrun.c @ 30122:210676ec9d5f legacy-trunk

Fix refcounting and cut & paste error (?) in last checkin. This should go onto release23-maint, too.
author Michael W. Hudson <mwh@python.net>
date Mon, 11 Aug 2003 12:20:24 +0000
parents a88e6dfbfd6d
children e3ebd740d1ef 3b59fa5d25b1
line wrap: on
line diff
--- a/Python/pythonrun.c	Mon Aug 11 12:13:14 2003 +0000
+++ b/Python/pythonrun.c	Mon Aug 11 12:20:24 2003 +0000
@@ -252,7 +252,7 @@
 	setlocale(LC_CTYPE, saved_locale);
 
 	if (codeset) {
-		sys_stream = PySys_GetObject("stdout");
+		sys_stream = PySys_GetObject("stdin");
 		sys_isatty = PyObject_CallMethod(sys_stream, "isatty", "");
 		if (!sys_isatty)
 			PyErr_Clear();
@@ -260,7 +260,6 @@
 			if (!PyFile_SetEncoding(sys_stream, codeset))
 				Py_FatalError("Cannot set codeset of stdin");
 		}
-		Py_XDECREF(sys_stream);
 		Py_XDECREF(sys_isatty);
 
 		sys_stream = PySys_GetObject("stdout");
@@ -271,7 +270,6 @@
 			if (!PyFile_SetEncoding(sys_stream, codeset))
 				Py_FatalError("Cannot set codeset of stdout");
 		}
-		Py_XDECREF(sys_stream);
 		Py_XDECREF(sys_isatty);
 
 		if (!Py_FileSystemDefaultEncoding)