Index: src/multiarray/numpyos.c ================================================================= --- src/multiarray/numpyos.c (revision 8498) +++ src/multiarray/numpyos.c (working copy) @@ -418,6 +418,32 @@ return 0; } +/* + * _NumPyOS_ascii_strtod_plain: + * + * PyOS_ascii_strtod work-alike, with no enhanced features, + * for forward compatibility with Python >= 2.7 + */ +static double +NumPyOS_ascii_strtod_plain(const char *s, char** endptr) +{ + double result; +#if PY_VERSION_HEX >= 0x02070000 + NPY_ALLOW_C_API_DEF + NPY_ALLOW_C_API + result = PyOS_string_to_double(s, endptr, NULL); + if (PyErr_Occurred()) { + if (endptr) { + *endptr = (char*)s; + } + PyErr_Clear(); + } + NPY_DISABLE_C_API +#else + result = PyOS_ascii_strtod(s, endptr); +#endif + return result; +} /* * NumPyOS_ascii_strtod: @@ -506,7 +532,7 @@ } memcpy(buffer, s, n); buffer[n] = '\0'; - result = PyOS_ascii_strtod(buffer, &q); + result = NumPyOS_ascii_strtod_plain(buffer, &q); if (endptr != NULL) { *endptr = (char*)(s + (q - buffer)); } @@ -515,7 +541,7 @@ } /* End of ##2 */ - return PyOS_ascii_strtod(s, endptr); + return NumPyOS_ascii_strtod_plain(s, endptr); }