summaryrefslogtreecommitdiff
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index af3d5ef055..6de32decc5 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -5,6 +5,7 @@
#include "Python-ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_context.h"
+#include "pycore_fileutils.h"
#include "pycore_hamt.h"
#include "pycore_pathconfig.h"
#include "pycore_pylifecycle.h"
@@ -394,6 +395,7 @@ done:
char *
_Py_SetLocaleFromEnv(int category)
{
+ char *res;
#ifdef __ANDROID__
const char *locale;
const char **pvar;
@@ -440,10 +442,12 @@ _Py_SetLocaleFromEnv(int category)
}
}
#endif
- return setlocale(category, utf8_locale);
-#else /* __ANDROID__ */
- return setlocale(category, "");
-#endif /* __ANDROID__ */
+ res = setlocale(category, utf8_locale);
+#else /* !defined(__ANDROID__) */
+ res = setlocale(category, "");
+#endif
+ _Py_ResetForceASCII();
+ return res;
}