]> granicus.if.org Git - python/commitdiff
Fix refcounting and cut & paste error (?) in last checkin.
authorMichael W. Hudson <mwh@python.net>
Mon, 11 Aug 2003 12:20:24 +0000 (12:20 +0000)
committerMichael W. Hudson <mwh@python.net>
Mon, 11 Aug 2003 12:20:24 +0000 (12:20 +0000)
This should go onto release23-maint, too.

Python/pythonrun.c

index f82de0adbe24bbc2f13ff3f35830bfe8cba4d00d..018400cb9208d3e8f437e3a326e911f1ed372768 100644 (file)
@@ -252,7 +252,7 @@ Py_Initialize(void)
        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 @@ Py_Initialize(void)
                        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 @@ Py_Initialize(void)
                        if (!PyFile_SetEncoding(sys_stream, codeset))
                                Py_FatalError("Cannot set codeset of stdout");
                }
-               Py_XDECREF(sys_stream);
                Py_XDECREF(sys_isatty);
 
                if (!Py_FileSystemDefaultEncoding)