mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
More bug 460020: when F is a subclass of float, disable the unary plus
optimization (+F(whatever)).
This commit is contained in:
parent
73a1dfe367
commit
0280cf79a7
2 changed files with 7 additions and 2 deletions
|
@ -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 *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue