1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
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
|