diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-11-13 07:43:21 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-11-13 07:43:21 +0000 |
commit | 91e3e8b7a94414f5ce641cdc5dca6fd1d9468cf3 (patch) | |
tree | dc9adfda81521165bd90c97080bdd9eacec9e238 /Python/pythonrun.c | |
parent | 7f4224803ffb7b26b5175caea3b1f018a3a29f70 (diff) | |
download | cpython-91e3e8b7a94414f5ce641cdc5dca6fd1d9468cf3.tar.gz |
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 21c2cace81..ab6ed58e52 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"); |