summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 539c4a9..55f43cb 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -926,7 +926,10 @@ float_int(PyObject *v)
static PyObject *
float_float(PyObject *v)
{
- Py_INCREF(v);
+ if (PyFloat_CheckExact(v))
+ Py_INCREF(v);
+ else
+ v = PyFloat_FromDouble(((PyFloatObject *)v)->ob_fval);
return v;
}