diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-11 21:53:35 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-11 21:53:35 (GMT) |
commit | 0280cf79a71cf2bf710d57e921d61184aa1b2dfd (patch) | |
tree | c5dd1d437398d512b4be1cb0cc8724733656286c /Objects/floatobject.c | |
parent | 73a1dfe3674429f923e98b84ef01df1614baad2f (diff) | |
download | cpython-0280cf79a71cf2bf710d57e921d61184aa1b2dfd.zip cpython-0280cf79a71cf2bf710d57e921d61184aa1b2dfd.tar.gz cpython-0280cf79a71cf2bf710d57e921d61184aa1b2dfd.tar.bz2 |
More bug 460020: when F is a subclass of float, disable the unary plus
optimization (+F(whatever)).
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index d606547..880eb0e 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -553,8 +553,12 @@ float_neg(PyFloatObject *v) static PyObject * float_pos(PyFloatObject *v) { - Py_INCREF(v); - return (PyObject *)v; + if (PyFloat_CheckExact(v)) { + Py_INCREF(v); + return (PyObject *)v; + } + else + return PyFloat_FromDouble(v->ob_fval); } static PyObject * |