Commit 0280cf79 authored by Tim Peters's avatar Tim Peters

More bug 460020: when F is a subclass of float, disable the unary plus

optimization (+F(whatever)).
parent 73a1dfe3
......@@ -1401,6 +1401,7 @@ def inherits():
a = precfloat(12345)
verify(float(a) == 12345.0)
verify(float(a).__class__ is float)
verify((+a).__class__ is float)
class madtuple(tuple):
_rev = None
......
......@@ -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 *
......
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