mirror of
https://github.com/python/cpython
synced 2026-09-29 10:35:30 +03:00
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99513)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
This commit is contained in:
parent
ea88d34de2
commit
3ed8803ef5
12 changed files with 22 additions and 44 deletions
|
|
@ -2937,8 +2937,7 @@ PyCData_FromBaseObj(PyObject *type, PyObject *base, Py_ssize_t index, char *adr)
|
|||
assert(CDataObject_Check(base));
|
||||
cmem->b_ptr = adr;
|
||||
cmem->b_needsfree = 0;
|
||||
Py_INCREF(base);
|
||||
cmem->b_base = (CDataObject *)base;
|
||||
cmem->b_base = (CDataObject *)Py_NewRef(base);
|
||||
cmem->b_index = index;
|
||||
} else { /* copy contents of adr */
|
||||
if (-1 == PyCData_MallocBuffer(cmem, dict)) {
|
||||
|
|
|
|||
|
|
@ -230,8 +230,7 @@ PyCField_get(CFieldObject *self, PyObject *inst, PyTypeObject *type)
|
|||
{
|
||||
CDataObject *src;
|
||||
if (inst == NULL) {
|
||||
Py_INCREF(self);
|
||||
return (PyObject *)self;
|
||||
return Py_NewRef(self);
|
||||
}
|
||||
if (!CDataObject_Check(inst)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue