aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/getargs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index f0b84b8338d..703462242a0 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 {