From c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 14 Nov 2022 13:44:56 +0100 Subject: 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. --- Modules/_xxsubinterpretersmodule.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Modules/_xxsubinterpretersmodule.c') diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c index 9d979ef113..e65137e58f 100644 --- a/Modules/_xxsubinterpretersmodule.c +++ b/Modules/_xxsubinterpretersmodule.c @@ -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; } -- cgit v1.2.1