Commit 765dd499 authored by Stefan Behnel's avatar Stefan Behnel

Simplify some redundant code by calling the obvious helper function instead.

parent 8db370d5
...@@ -596,11 +596,14 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ ...@@ -596,11 +596,14 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
#endif #endif
/////////////// pyobject_as_double /////////////// /////////////// pyobject_as_double ///////////////
//@requires: ObjectHandling.c::PyObjectCallOneArg
static double __Pyx__PyObject_AsDouble(PyObject* obj) { static double __Pyx__PyObject_AsDouble(PyObject* obj) {
PyObject* float_value; PyObject* float_value;
#if !CYTHON_USE_TYPE_SLOTS #if !CYTHON_USE_TYPE_SLOTS
float_value = PyNumber_Float(obj); if ((0)) goto bad; float_value = PyNumber_Float(obj); if ((0)) goto bad;
// avoid "unused" warnings
(void)__Pyx_PyObject_CallOneArg;
#else #else
PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number; PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
if (likely(nb) && likely(nb->nb_float)) { if (likely(nb) && likely(nb->nb_float)) {
...@@ -619,12 +622,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) { ...@@ -619,12 +622,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
float_value = PyFloat_FromString(obj, 0); float_value = PyFloat_FromString(obj, 0);
#endif #endif
} else { } else {
PyObject* args = PyTuple_New(1); float_value = __Pyx_PyObject_CallOneArg((PyObject*)&PyFloat_Type, obj);
if (unlikely(!args)) goto bad;
PyTuple_SET_ITEM(args, 0, obj);
float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
PyTuple_SET_ITEM(args, 0, 0);
Py_DECREF(args);
} }
#endif #endif
if (likely(float_value)) { if (likely(float_value)) {
......
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