Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 30910:a29a585b03d9 legacy-trunk
Patch #804543: strdup saved locales. Backported to 2.3.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 13 Nov 2003 07:43:21 +0000 |
| parents | 3b59fa5d25b1 |
| children | b6c139544c16 |
line wrap: on
line diff
--- a/Python/pythonrun.c Wed Nov 12 20:43:28 2003 +0000 +++ b/Python/pythonrun.c Thu Nov 13 07:43:21 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");
