summaryrefslogtreecommitdiff
path: root/Objects/unionobject.c
diff options
context:
space:
mode:
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));