mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
This commit is contained in:
parent
19c1462e8d
commit
8211cf5d28
18 changed files with 40 additions and 74 deletions
|
@ -428,8 +428,7 @@ _PyCodec_EncodeInternal(PyObject *object,
|
|||
"encoder must return a tuple (object, integer)");
|
||||
goto onError;
|
||||
}
|
||||
v = PyTuple_GET_ITEM(result,0);
|
||||
Py_INCREF(v);
|
||||
v = Py_NewRef(PyTuple_GET_ITEM(result,0));
|
||||
/* We don't check or use the second (integer) entry. */
|
||||
|
||||
Py_DECREF(args);
|
||||
|
@ -473,8 +472,7 @@ _PyCodec_DecodeInternal(PyObject *object,
|
|||
"decoder must return a tuple (object,integer)");
|
||||
goto onError;
|
||||
}
|
||||
v = PyTuple_GET_ITEM(result,0);
|
||||
Py_INCREF(v);
|
||||
v = Py_NewRef(PyTuple_GET_ITEM(result,0));
|
||||
/* We don't check or use the second (integer) entry. */
|
||||
|
||||
Py_DECREF(args);
|
||||
|
@ -569,8 +567,7 @@ PyObject *codec_getitem_checked(const char *encoding,
|
|||
if (codec == NULL)
|
||||
return NULL;
|
||||
|
||||
v = PyTuple_GET_ITEM(codec, index);
|
||||
Py_INCREF(v);
|
||||
v = Py_NewRef(PyTuple_GET_ITEM(codec, index));
|
||||
Py_DECREF(codec);
|
||||
return v;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue