mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
gh-99300: Use Py_NewRef() in Modules/ directory (#99468)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
This commit is contained in:
parent
9a7e9f9921
commit
c340cbb7f7
10 changed files with 92 additions and 173 deletions
|
@ -1829,8 +1829,7 @@ Struct_iter_unpack(PyStructObject *self, PyObject *buffer)
|
|||
Py_DECREF(iter);
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(self);
|
||||
iter->so = self;
|
||||
iter->so = (PyStructObject*)Py_NewRef(self);
|
||||
iter->index = 0;
|
||||
return (PyObject *)iter;
|
||||
}
|
||||
|
@ -2178,8 +2177,7 @@ cache_struct_converter(PyObject *module, PyObject *fmt, PyStructObject **ptr)
|
|||
|
||||
s_object = PyDict_GetItemWithError(state->cache, fmt);
|
||||
if (s_object != NULL) {
|
||||
Py_INCREF(s_object);
|
||||
*ptr = (PyStructObject *)s_object;
|
||||
*ptr = (PyStructObject *)Py_NewRef(s_object);
|
||||
return Py_CLEANUP_SUPPORTED;
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue