diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-16 09:39:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-16 09:39:47 (GMT) |
commit | 3ed8803ef59f80e03c40b100b04c2e13f138ceed (patch) | |
tree | ec9ce18edd242485d4e3198d8e62924e1616c4ea /Objects/setobject.c | |
parent | ea88d34de27ba2b3acaeb03c7dc7829dff40ea5c (diff) | |
download | cpython-3ed8803ef59f80e03c40b100b04c2e13f138ceed.zip cpython-3ed8803ef59f80e03c40b100b04c2e13f138ceed.tar.gz cpython-3ed8803ef59f80e03c40b100b04c2e13f138ceed.tar.bz2 |
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99513)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef()
and Py_XNewRef().
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r-- | Objects/setobject.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index 3c510b5..e064676 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -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 * |