gh-99300: Replace Py_INCREF() with Py_NewRef() (#99513)

Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef()
and Py_XNewRef().
This commit is contained in:
Victor Stinner 2022-11-16 10:39:47 +01:00 committed by GitHub
parent ea88d34de2
commit 3ed8803ef5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 22 additions and 44 deletions

View file

@ -1601,8 +1601,7 @@ set_isub(PySetObject *so, PyObject *other)
Py_RETURN_NOTIMPLEMENTED;
if (set_difference_update_internal(so, other))
return NULL;
Py_INCREF(so);
return (PyObject *)so;
return Py_NewRef(so);
}
static PyObject *
@ -1639,8 +1638,7 @@ set_symmetric_difference_update(PySetObject *so, PyObject *other)
}
if (PyAnySet_Check(other)) {
Py_INCREF(other);
otherset = (PySetObject *)other;
otherset = (PySetObject *)Py_NewRef(other);
} else {
otherset = (PySetObject *)make_new_set_basetype(Py_TYPE(so), other);
if (otherset == NULL)
@ -1715,8 +1713,7 @@ set_ixor(PySetObject *so, PyObject *other)
if (result == NULL)
return NULL;
Py_DECREF(result);
Py_INCREF(so);
return (PyObject *)so;
return Py_NewRef(so);
}
static PyObject *