summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-11-13 07:42:13 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-11-13 07:42:13 (GMT)
commit604b120ca62c97c0ca57bdf25df552db82790804 (patch)
treeaee018c4337b7296b2d1d45242d6834f3262e8a4 /Python/pythonrun.c
parent695461f2004a9a74892e347e5bdcf18f84f37568 (diff)
downloadcpython-604b120ca62c97c0ca57bdf25df552db82790804.zip
cpython-604b120ca62c97c0ca57bdf25df552db82790804.tar.gz
cpython-604b120ca62c97c0ca57bdf25df552db82790804.tar.bz2
Patch #804543: strdup saved locales.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 018400c..d32c376 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");