From f56d015a7123de2df3a32bc38f666a79dd8cab79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Thu, 13 Nov 2003 07:43:21 +0000 Subject: Patch #804543: strdup saved locales. Backported to 2.3. --- Python/pythonrun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Python/pythonrun.c') 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"); -- cgit v1.2.1