Commit f1d021fe authored by Stefan Behnel's avatar Stefan Behnel

Special case float parsing in PyPy since byte string access is likely slower...

Special case float parsing in PyPy since byte string access is likely slower there than a plain float object creation. (And it works in all PyPy versions.)
parent 571514e6
......@@ -667,7 +667,7 @@ static CYTHON_INLINE double __Pyx_PyUnicode_AsDouble(PyObject *obj);/*proto*/
static CYTHON_INLINE double __Pyx_PyUnicode_AsDouble(PyObject *obj) {
// Currently not optimised for 1) Py2.7 and 2) Py3 unicode strings with non-ASCII whitespace.
// See __Pyx__PyBytes_AsDouble() below, the same byte buffer copying could be done here.
#if PY_MAJOR_VERSION >= 3
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
if (unlikely(PyUnicode_READY(obj) == -1))
return (double)-1;
if (likely(PyUnicode_IS_ASCII(obj))) {
......@@ -687,10 +687,18 @@ static double __Pyx_SlowPyString_AsDouble(PyObject *obj);/*proto*/
static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length);/*proto*/
static CYTHON_INLINE double __Pyx_PyBytes_AsDouble(PyObject *obj) {
#if CYTHON_COMPILING_IN_PYPY
return __Pyx_SlowPyString_AsDouble(obj);
#else
return __Pyx__PyBytes_AsDouble(obj, PyBytes_AS_STRING(obj), PyBytes_GET_SIZE(obj));
#endif
}
static CYTHON_INLINE double __Pyx_PyByteArray_AsDouble(PyObject *obj) {
#if CYTHON_COMPILING_IN_PYPY
return __Pyx_SlowPyString_AsDouble(obj);
#else
return __Pyx__PyBytes_AsDouble(obj, PyByteArray_AS_STRING(obj), PyByteArray_GET_SIZE(obj));
#endif
}
......@@ -720,7 +728,7 @@ static const char* __Pyx__PyBytes_AsDouble_Copy(const char* start, char* buffer,
return buffer;
}
static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length) {
static CYTHON_UNUSED double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length) {
double value;
Py_ssize_t i, digits;
const char *last = start + length;
......
......@@ -2,10 +2,6 @@
# either in PyPy, PyPy's cpyext, or Cython under PyPy,
# which will be skipped in the normal testing run.
# See https://foss.heptapod.net/pypy/pypy/-/issues/3375
float_division
specialfloat
broken_exception
bufaccess
memoryview.memoryview$
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment