Kaydet (Commit) f56d015a authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Patch #804543: strdup saved locales. Backported to 2.3.

üst add09b41
......@@ -611,7 +611,7 @@ static void
setup_readline(void)
{
#ifdef SAVE_LOCALE
char *saved_locale = setlocale(LC_CTYPE, NULL);
char *saved_locale = strdup(setlocale(LC_CTYPE, NULL));
#endif
using_history();
......@@ -652,6 +652,7 @@ setup_readline(void)
#ifdef SAVE_LOCALE
setlocale(LC_CTYPE, saved_locale); /* Restore locale */
free(saved_locale);
#endif
}
......
......@@ -235,7 +235,7 @@ Py_Initialize(void)
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 @@ Py_Initialize(void)
} else
codeset = NULL;
setlocale(LC_CTYPE, saved_locale);
free(saved_locale);
if (codeset) {
sys_stream = PySys_GetObject("stdin");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment