summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-10 21:22:02 (GMT)
committerGitHub <noreply@github.com>2022-11-10 21:22:02 (GMT)
commit584e55bd34a38a0bd4b6ed3534fdbf7dc35c64b0 (patch)
tree3eb2005170635a27dc24516ace42a4cca741be38 /Objects/floatobject.c
parent2f4af2d99cffed6ba81e4b8fd886de6ae8625a3f (diff)
downloadcpython-584e55bd34a38a0bd4b6ed3534fdbf7dc35c64b0.zip
cpython-584e55bd34a38a0bd4b6ed3534fdbf7dc35c64b0.tar.gz
cpython-584e55bd34a38a0bd4b6ed3534fdbf7dc35c64b0.tar.bz2
gh-99300: Use Py_NewRef() in Objects/ directory (#99335)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index c435357..65383b2 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -371,8 +371,7 @@ convert_to_double(PyObject **v, double *dbl)
}
}
else {
- Py_INCREF(Py_NotImplemented);
- *v = Py_NotImplemented;
+ *v = Py_NewRef(Py_NotImplemented);
return -1;
}
return 0;
@@ -904,8 +903,7 @@ float_is_integer_impl(PyObject *self)
PyExc_ValueError);
return NULL;
}
- Py_INCREF(o);
- return o;
+ return Py_NewRef(o);
}
/*[clinic input]
@@ -1124,11 +1122,12 @@ float___round___impl(PyObject *self, PyObject *o_ndigits)
static PyObject *
float_float(PyObject *v)
{
- if (PyFloat_CheckExact(v))
- Py_INCREF(v);
- else
- v = PyFloat_FromDouble(((PyFloatObject *)v)->ob_fval);
- return v;
+ if (PyFloat_CheckExact(v)) {
+ return Py_NewRef(v);
+ }
+ else {
+ return PyFloat_FromDouble(((PyFloatObject *)v)->ob_fval);
+ }
}
/*[clinic input]