Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73a1dfe commit 0280cf7Copy full SHA for 0280cf7
2 files changed
Lib/test/test_descr.py
@@ -1401,6 +1401,7 @@ def __repr__(self):
1401
a = precfloat(12345)
1402
verify(float(a) == 12345.0)
1403
verify(float(a).__class__ is float)
1404
+ verify((+a).__class__ is float)
1405
1406
class madtuple(tuple):
1407
_rev = None
Objects/floatobject.c
@@ -553,8 +553,12 @@ float_neg(PyFloatObject *v)
553
static PyObject *
554
float_pos(PyFloatObject *v)
555
{
556
- Py_INCREF(v);
557
- return (PyObject *)v;
+ if (PyFloat_CheckExact(v)) {
+ Py_INCREF(v);
558
+ return (PyObject *)v;
559
+ }
560
+ else
561
+ return PyFloat_FromDouble(v->ob_fval);
562
}
563
564
0 commit comments