diff --git a/Modules/main.c b/Modules/main.c index d75f64a..143a452 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -557,8 +557,8 @@ Py_Main(int argc, wchar_t **argv) Py_FatalError( "not enough memory to copy PYTHONWARNINGS"); strcpy(buf, p); - oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL)); - setlocale(LC_ALL, ""); + //oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL)); + //setlocale(LC_ALL, ""); for (p = strtok(buf, ","); p != NULL; p = strtok(NULL, ",")) { #ifdef __APPLE__ /* Use utf-8 on Mac OS X */ @@ -574,8 +574,8 @@ Py_Main(int argc, wchar_t **argv) PySys_AddWarnOptionUnicode(unicode); Py_DECREF(unicode); } - setlocale(LC_ALL, oldloc); - PyMem_RawFree(oldloc); + //setlocale(LC_ALL, oldloc); + //PyMem_RawFree(oldloc); PyMem_RawFree(buf); } #endif diff --git a/Programs/python.c b/Programs/python.c index a7afbc7..07fcbe0 100644 --- a/Programs/python.c +++ b/Programs/python.c @@ -43,17 +43,17 @@ main(int argc, char **argv) fedisableexcept(FE_OVERFLOW); #endif - oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL)); - if (!oldloc) { - fprintf(stderr, "out of memory\n"); - return 1; - } + // oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL)); + // if (!oldloc) { + // fprintf(stderr, "out of memory\n"); + // return 1; + // } - setlocale(LC_ALL, ""); + // setlocale(LC_ALL, ""); for (i = 0; i < argc; i++) { argv_copy[i] = Py_DecodeLocale(argv[i], NULL); if (!argv_copy[i]) { - PyMem_RawFree(oldloc); + //PyMem_RawFree(oldloc); fprintf(stderr, "Fatal Python error: " "unable to decode the command line argument #%i\n", i + 1); @@ -63,8 +63,8 @@ main(int argc, char **argv) } argv_copy2[argc] = argv_copy[argc] = NULL; - setlocale(LC_ALL, oldloc); - PyMem_RawFree(oldloc); + //setlocale(LC_ALL, oldloc); + //PyMem_RawFree(oldloc); res = Py_Main(argc, argv_copy); diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index a4f7f82..823372f 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -238,6 +238,8 @@ get_locale_encoding(void) return get_codec_name(codeset); #elif defined(__ANDROID__) return get_codec_name("UTF-8"); +#elif defined(__serenity__) + return get_codec_name("UTF-8"); #else PyErr_SetNone(PyExc_NotImplementedError); return NULL; -- 2.17.1