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

optimization (+F(whatever)).
This commit is contained in:
Tim Peters 2001-09-11 21:53:35 +00:00
parent 73a1dfe367
commit 0280cf79a7
2 changed files with 7 additions and 2 deletions

View file

@ -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 *