diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-10 08:03:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 08:03:39 (GMT) |
commit | d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20 (patch) | |
tree | 7055b2d966bf41e636751177cea0248b56072e92 /Python/getargs.c | |
parent | f883b7f8ee3209b52863fc662343c8cd81abdc59 (diff) | |
download | cpython-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/getargs.c')
-rw-r--r-- | Python/getargs.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index f0b84b8..7034622 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -1046,8 +1046,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, /* Encode object */ if (!recode_strings && (PyBytes_Check(arg) || PyByteArray_Check(arg))) { - s = arg; - Py_INCREF(s); + s = Py_NewRef(arg); if (PyBytes_Check(arg)) { size = PyBytes_GET_SIZE(s); ptr = PyBytes_AS_STRING(s); @@ -2575,8 +2574,7 @@ _PyArg_UnpackKeywordsWithVararg(PyObject *const *args, Py_ssize_t nargs, /* copy tuple args */ for (i = 0; i < nargs; i++) { if (i >= vararg) { - Py_INCREF(args[i]); - PyTuple_SET_ITEM(buf[vararg], i - vararg, args[i]); + PyTuple_SET_ITEM(buf[vararg], i - vararg, Py_NewRef(args[i])); continue; } else { |