summaryrefslogtreecommitdiff
path: root/Objects/unionobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-16 18:34:24 +0100
committerGitHub <noreply@github.com>2022-11-16 18:34:24 +0100
commit8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b (patch)
tree510409237622aa30dfc6833602bdde97c578f2bb /Objects/unionobject.c
parent19c1462e8dca3319c8290e2edcce482bd18cb018 (diff)
downloadcpython-git-8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b.tar.gz
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
Diffstat (limited to 'Objects/unionobject.c')
-rw-r--r--Objects/unionobject.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/unionobject.c b/Objects/unionobject.c
index b2ac3509ce..f273f7d15e 100644
--- a/Objects/unionobject.c
+++ b/Objects/unionobject.c
@@ -295,8 +295,7 @@ union_getitem(PyObject *self, PyObject *item)
res = make_union(newargs);
}
else {
- res = PyTuple_GET_ITEM(newargs, 0);
- Py_INCREF(res);
+ res = Py_NewRef(PyTuple_GET_ITEM(newargs, 0));
for (Py_ssize_t iarg = 1; iarg < nargs; iarg++) {
PyObject *arg = PyTuple_GET_ITEM(newargs, iarg);
Py_SETREF(res, PyNumber_Or(res, arg));