mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
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.
This commit is contained in:
parent
2f4af2d99c
commit
584e55bd34
8 changed files with 120 additions and 244 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue