mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +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
|
@ -1722,8 +1722,7 @@ _channelid_shared(PyObject *obj, _PyCrossInterpreterData *data)
|
|||
xid->resolve = ((channelid *)obj)->resolve;
|
||||
|
||||
data->data = xid;
|
||||
Py_INCREF(obj);
|
||||
data->obj = obj;
|
||||
data->obj = Py_NewRef(obj);
|
||||
data->new_object = _channelid_from_xid;
|
||||
data->free = PyMem_Free;
|
||||
return 0;
|
||||
|
@ -2634,12 +2633,12 @@ PyInit__xxsubinterpreters(void)
|
|||
}
|
||||
|
||||
/* Add other types */
|
||||
Py_INCREF(&ChannelIDtype);
|
||||
if (PyDict_SetItemString(ns, "ChannelID", (PyObject *)&ChannelIDtype) != 0) {
|
||||
if (PyDict_SetItemString(ns, "ChannelID",
|
||||
Py_NewRef(&ChannelIDtype)) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(&_PyInterpreterID_Type);
|
||||
if (PyDict_SetItemString(ns, "InterpreterID", (PyObject *)&_PyInterpreterID_Type) != 0) {
|
||||
if (PyDict_SetItemString(ns, "InterpreterID",
|
||||
Py_NewRef(&_PyInterpreterID_Type)) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue