summaryrefslogtreecommitdiffstats
path: root/Python/ast_opt.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-10 08:03:39 (GMT)
committerGitHub <noreply@github.com>2022-11-10 08:03:39 (GMT)
commitd8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20 (patch)
tree7055b2d966bf41e636751177cea0248b56072e92 /Python/ast_opt.c
parentf883b7f8ee3209b52863fc662343c8cd81abdc59 (diff)
downloadcpython-d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20.zip
cpython-d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20.tar.gz
cpython-d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20.tar.bz2
gh-99300: Use Py_NewRef() in Python/ directory (#99302)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
Diffstat (limited to 'Python/ast_opt.c')
-rw-r--r--Python/ast_opt.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index 426c534..1a0b2a0 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -533,8 +533,7 @@ make_const_tuple(asdl_expr_seq *elts)
for (int i = 0; i < asdl_seq_LEN(elts); i++) {
expr_ty e = (expr_ty)asdl_seq_GET(elts, i);
PyObject *v = e->v.Constant.value;
- Py_INCREF(v);
- PyTuple_SET_ITEM(newval, i, v);
+ PyTuple_SET_ITEM(newval, i, Py_NewRef(v));
}
return newval;
}