gh-99300: Use Py_NewRef() in Modules/ directory (#99466)

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:
Victor Stinner 2022-11-14 13:08:15 +01:00 committed by GitHub
parent db115682bd
commit 3817607b8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 106 additions and 214 deletions

View file

@ -389,8 +389,7 @@ PyCurses_ConvertToString(PyCursesWindowObject *win, PyObject *obj,
#endif
}
else if (PyBytes_Check(obj)) {
Py_INCREF(obj);
*bytes = obj;
*bytes = Py_NewRef(obj);
/* check for embedded null bytes */
if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) {
Py_DECREF(obj);