diff Python/pythonrun.c @ 30909:e3ebd740d1ef 2.3

Patch #804543: strdup saved locales.
author Martin v. Löwis <martin@v.loewis.de>
date Thu, 13 Nov 2003 07:42:13 +0000
parents 1598fbe693f9
children bf7df48012cb
line wrap: on
line diff
--- a/Python/pythonrun.c	Thu Nov 13 01:17:55 2003 +0000
+++ b/Python/pythonrun.c	Thu Nov 13 07:42:13 2003 +0000
@@ -235,7 +235,7 @@
 	   initialized by other means. Also set the encoding of
 	   stdin and stdout if these are terminals.  */
 
-	saved_locale = setlocale(LC_CTYPE, NULL);
+	saved_locale = strdup(setlocale(LC_CTYPE, NULL));
 	setlocale(LC_CTYPE, "");
 	codeset = nl_langinfo(CODESET);
 	if (codeset && *codeset) {
@@ -250,6 +250,7 @@
 	} else
 		codeset = NULL;
 	setlocale(LC_CTYPE, saved_locale);
+	free(saved_locale);
 
 	if (codeset) {
 		sys_stream = PySys_GetObject("stdin");