summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-03-30 06:09:41 (GMT)
committerGitHub <noreply@github.com>2017-03-30 06:09:41 (GMT)
commitba85d69a3e3610bdd05f0dd372cf4ebca178c7fb (patch)
treefe0766c34601880610c3399a8f01c35ab6e8fe8e /Objects/floatobject.c
parente6911a44f69c0d302db60f49952a9cf69da69a2b (diff)
downloadcpython-ba85d69a3e3610bdd05f0dd372cf4ebca178c7fb.zip
cpython-ba85d69a3e3610bdd05f0dd372cf4ebca178c7fb.tar.gz
cpython-ba85d69a3e3610bdd05f0dd372cf4ebca178c7fb.tar.bz2
bpo-29878: Add global instances of int for 0 and 1. (#852)
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 86c3c88..87af0ba 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -443,7 +443,6 @@ float_richcompare(PyObject *v, PyObject *w, int op)
double fracpart;
double intpart;
PyObject *result = NULL;
- PyObject *one = NULL;
PyObject *vv = NULL;
PyObject *ww = w;
@@ -466,23 +465,19 @@ float_richcompare(PyObject *v, PyObject *w, int op)
*/
PyObject *temp;
- one = PyLong_FromLong(1);
- if (one == NULL)
- goto Error;
-
- temp = PyNumber_Lshift(ww, one);
+ temp = PyNumber_Lshift(ww, _PyLong_One);
if (temp == NULL)
goto Error;
Py_DECREF(ww);
ww = temp;
- temp = PyNumber_Lshift(vv, one);
+ temp = PyNumber_Lshift(vv, _PyLong_One);
if (temp == NULL)
goto Error;
Py_DECREF(vv);
vv = temp;
- temp = PyNumber_Or(vv, one);
+ temp = PyNumber_Or(vv, _PyLong_One);
if (temp == NULL)
goto Error;
Py_DECREF(vv);
@@ -496,7 +491,6 @@ float_richcompare(PyObject *v, PyObject *w, int op)
Error:
Py_XDECREF(vv);
Py_XDECREF(ww);
- Py_XDECREF(one);
return result;
}
} /* else if (PyLong_Check(w)) */
@@ -1617,7 +1611,7 @@ float_subtype_new(PyTypeObject *type, PyObject *x);
/*[clinic input]
@classmethod
float.__new__ as float_new
- x: object(c_default="Py_False") = 0
+ x: object(c_default="_PyLong_Zero") = 0
/
Convert a string or number to a floating point number, if possible.