diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-11-13 07:43:21 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-11-13 07:43:21 (GMT) |
commit | f56d015a7123de2df3a32bc38f666a79dd8cab79 (patch) | |
tree | d6fa274862800df9c14d17d7fce7f9ea3130c854 /Python/pythonrun.c | |
parent | add09b4149b17afa30aa042dbb718b9d9ec741c3 (diff) | |
download | cpython-f56d015a7123de2df3a32bc38f666a79dd8cab79.zip cpython-f56d015a7123de2df3a32bc38f666a79dd8cab79.tar.gz cpython-f56d015a7123de2df3a32bc38f666a79dd8cab79.tar.bz2 |
Patch #804543: strdup saved locales. Backported to 2.3.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 21c2cac..ab6ed58 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -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"); |