summaryrefslogtreecommitdiffstats
path: root/Modules/_xxsubinterpretersmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-14 12:44:56 (GMT)
committerGitHub <noreply@github.com>2022-11-14 12:44:56 (GMT)
commitc340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8 (patch)
tree2fa984d78bf3aa7e8c713f33c7ffdd6ed5817eb4 /Modules/_xxsubinterpretersmodule.c
parent9a7e9f9921804f3f90151ca42703e612697dd430 (diff)
downloadcpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.zip
cpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.tar.gz
cpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.tar.bz2
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.
Diffstat (limited to 'Modules/_xxsubinterpretersmodule.c')
-rw-r--r--Modules/_xxsubinterpretersmodule.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index 9d979ef..e65137e 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;
}