1 diff --git a/Python/fileutils.c b/Python/fileutils.c
2 index b7c42e8..40db4f9 100644
3 --- a/Python/fileutils.c
4 +++ b/Python/fileutils.c
5 @@ -43,7 +43,7 @@ _Py_device_encoding(int fd)
9 -#if !defined(__APPLE__) && !defined(MS_WINDOWS)
10 +#if !defined(__APPLE__) && !defined(MS_WINDOWS) && !defined(__ANDROID__)
11 extern int _Py_normalize_encoding(const char *, char *, size_t);
13 /* Workaround FreeBSD and OpenIndiana locale encoding issue with the C locale.
14 @@ -260,7 +260,7 @@ _Py_char2wchar(const char* arg, size_t *size)
19 +#if !(defined(MS_WINDOWS) || defined(__ANDROID__))
20 if (force_ascii == -1)
21 force_ascii = check_force_ascii();
23 @@ -419,7 +419,7 @@ _Py_wchar2char(const wchar_t *text, size_t *error_pos)
24 size_t i, size, converted;
28 +#if !(defined(MS_WINDOWS) || defined(__ANDROID__))
29 if (force_ascii == -1)
30 force_ascii = check_force_ascii();
32 diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
33 index a6516dc..f06c2a0 100644
34 --- a/Python/formatter_unicode.c
35 +++ b/Python/formatter_unicode.c
36 @@ -664,6 +664,9 @@ static int
37 get_locale_info(int type, LocaleInfo *locale_info)
41 + case LT_CURRENT_LOCALE:
43 case LT_CURRENT_LOCALE: {
44 struct lconv *locale_data = localeconv();
45 locale_info->decimal_point = PyUnicode_DecodeLocale(
46 @@ -681,6 +684,7 @@ get_locale_info(int type, LocaleInfo *locale_info)
47 locale_info->grouping = locale_data->grouping;
51 case LT_DEFAULT_LOCALE:
52 locale_info->decimal_point = PyUnicode_FromOrdinal('.');
53 locale_info->thousands_sep = PyUnicode_FromOrdinal(',');
54 diff --git a/Python/pystrtod.c b/Python/pystrtod.c
55 index 4ab8f08..22b01a1 100644
56 --- a/Python/pystrtod.c
57 +++ b/Python/pystrtod.c
58 @@ -177,8 +177,12 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr)
63 + decimal_point = ".";
65 locale_data = localeconv();
66 decimal_point = locale_data->decimal_point;
68 decimal_point_len = strlen(decimal_point);
70 assert(decimal_point_len != 0);
71 @@ -378,8 +382,12 @@ PyOS_string_to_double(const char *s,
73 change_decimal_from_locale_to_dot(char* buffer)
76 + const char *decimal_point = ".";
78 struct lconv *locale_data = localeconv();
79 const char *decimal_point = locale_data->decimal_point;
82 if (decimal_point[0] != '.' || decimal_point[1] != 0) {
83 size_t decimal_point_len = strlen(decimal_point);
84 diff --git a/Python/pythonrun.c b/Python/pythonrun.c
85 index 832df53..c43e5e9 100644
86 --- a/Python/pythonrun.c
87 +++ b/Python/pythonrun.c
88 @@ -810,6 +810,51 @@ Py_SetPythonHome(wchar_t *home)
93 +size_t mbstowcs(wchar_t *dest, const char * in, size_t maxlen)
95 + wchar_t *out = dest;
99 + while(*in && (!out || size<maxlen)) {
104 + *out++ = 0xdc00 + *in++;
111 + if (out && size<maxlen)
116 +size_t wcstombs(char * dest, const wchar_t *source, size_t maxlen)
120 + for (i=0; (!dest || i<maxlen) && source[i]; i++)
123 + if (c >= 0xdc80 && c <= 0xdcff)
125 + /* UTF-8b surrogate */
131 + if (dest && i<maxlen)
138 Py_GetPythonHome(void)
140 --- a/configure.ac 2013-11-17 07:23:09.000000000 +0000
141 +++ b/configure.ac 2013-12-05 14:27:43.166191803 +0000
142 @@ -2829,7 +2829,7 @@
143 getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
144 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
146 - initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \
147 + initgroups kill killpg lchmod lchown localeconv lockf linkat lstat lutimes mmap \
148 memrchr mbrtowc mkdirat mkfifo \
149 mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \
150 posix_fallocate posix_fadvise pread \
151 --- a/Modules/_localemodule.c 2013-12-05 14:29:33.643662167 +0000
152 +++ b/Modules/_localemodule.c 2013-12-05 14:31:41.069332495 +0000
154 return result_object;
157 +#if defined(HAVE_LOCALECONV)
158 PyDoc_STRVAR(localeconv__doc__,
159 "() -> dict. Returns numeric and monetary locale-specific parameters.");
167 #if defined(HAVE_WCSCOLL)
168 PyDoc_STRVAR(strcoll__doc__,
170 static struct PyMethodDef PyLocale_Methods[] = {
171 {"setlocale", (PyCFunction) PyLocale_setlocale,
172 METH_VARARGS, setlocale__doc__},
173 +#ifdef HAVE_LOCALECONV
174 {"localeconv", (PyCFunction) PyLocale_localeconv,
175 METH_NOARGS, localeconv__doc__},
178 {"strcoll", (PyCFunction) PyLocale_strcoll,
179 METH_VARARGS, strcoll__doc__},
180 --- a/Modules/pwdmodule.c 2013-12-05 14:41:59.065464798 +0000
181 +++ b/Modules/pwdmodule.c 2013-12-05 14:42:17.045681049 +0000
184 PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid));
185 PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid));
187 +#if defined(__VMS) || defined(__ANDROID__)
188 SETS(setIndex++, "");
190 SETS(setIndex++, p->pw_gecos);
191 --- a/Python/bltinmodule.c 2014-04-13 10:14:13.053260705 +0200
192 +++ b/Python/bltinmodule.c 2014-04-26 15:18:24.094444817 +0200
195 const char *Py_FileSystemDefaultEncoding = "mbcs";
196 int Py_HasFileSystemDefaultEncoding = 1;
197 -#elif defined(__APPLE__)
198 +#elif defined(__APPLE__) || defined(__ANDROID__)
199 const char *Py_FileSystemDefaultEncoding = "utf-8";
200 int Py_HasFileSystemDefaultEncoding = 1;
202 --- a/Lib/locale.py 2014-04-26 14:35:53.243526608 +0200
203 +++ b/Lib/locale.py 2014-04-26 14:36:53.752085946 +0200
207 from _locale import *
208 + raise ImportError("")