diff -r 9e03e149be3b -r ec1b9f3ace31 Modules/_decimal/libmpdec/io.c --- a/Modules/_decimal/libmpdec/io.c Thu Mar 19 14:10:29 2015 -0500 +++ b/Modules/_decimal/libmpdec/io.c Thu Mar 19 14:18:34 2015 -0500 @@ -868,10 +868,17 @@ } spec->type = *cp++; spec->type = (spec->type == 'N') ? 'G' : 'g'; +#ifdef __ANDROID__ + spec->dot = "."; + spec->sep = ",': + spec->grouping = "\3"; +#else lc = localeconv(); spec->dot = lc->decimal_point; spec->sep = lc->thousands_sep; spec->grouping = lc->grouping; +#endif + if (mpd_validate_lconv(spec) < 0) { return 0; /* GCOV_NOT_REACHED */ } diff -r 9e03e149be3b -r ec1b9f3ace31 Modules/_localemodule.c --- a/Modules/_localemodule.c Thu Mar 19 14:10:29 2015 -0500 +++ b/Modules/_localemodule.c Thu Mar 19 14:18:34 2015 -0500 @@ -141,6 +141,11 @@ if (!result) return NULL; +#ifdef __ANDROID__ + /* Don't even try on Android's broken locale.h. */ + goto failed; +#else + /* if LC_NUMERIC is different in the C library, use saved value */ l = localeconv(); @@ -195,6 +200,7 @@ RESULT_INT(p_sign_posn); RESULT_INT(n_sign_posn); return result; +#endif /* __ANDROID__ */ failed: Py_XDECREF(result); diff -r 9e03e149be3b -r ec1b9f3ace31 Python/formatter_unicode.c --- a/Python/formatter_unicode.c Thu Mar 19 14:10:29 2015 -0500 +++ b/Python/formatter_unicode.c Thu Mar 19 14:18:34 2015 -0500 @@ -667,6 +667,7 @@ { switch (type) { case LT_CURRENT_LOCALE: { +#ifndef __ANDROID__ struct lconv *locale_data = localeconv(); locale_info->decimal_point = PyUnicode_DecodeLocale( locale_data->decimal_point, @@ -682,6 +683,7 @@ } locale_info->grouping = locale_data->grouping; break; +#endif /* __ANDROID__ */ } case LT_DEFAULT_LOCALE: locale_info->decimal_point = PyUnicode_FromOrdinal('.'); diff -r 9e03e149be3b -r ec1b9f3ace31 Python/pystrtod.c --- a/Python/pystrtod.c Thu Mar 19 14:10:29 2015 -0500 +++ b/Python/pystrtod.c Thu Mar 19 14:18:34 2015 -0500 @@ -177,11 +177,16 @@ fail_pos = NULL; +#ifdef __ANDROID__ + decimal_point = "."; + decimal_point_len = 1; +#else locale_data = localeconv(); decimal_point = locale_data->decimal_point; decimal_point_len = strlen(decimal_point); assert(decimal_point_len != 0); +#endif decimal_point_pos = NULL; @@ -378,8 +383,12 @@ Py_LOCAL_INLINE(void) change_decimal_from_locale_to_dot(char* buffer) { +#ifdef __ANDROID__ + const char *decimal_point = "."; +#else struct lconv *locale_data = localeconv(); const char *decimal_point = locale_data->decimal_point; +#endif if (decimal_point[0] != '.' || decimal_point[1] != 0) { size_t decimal_point_len = strlen(decimal_point);