gh-99300: Replace Py_INCREF() with Py_NewRef() (#99513)

Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef()
and Py_XNewRef().
This commit is contained in:
Victor Stinner 2022-11-16 10:39:47 +01:00 committed by GitHub
parent ea88d34de2
commit 3ed8803ef5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 22 additions and 44 deletions

View file

@ -45,8 +45,7 @@ PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname
PyThreadState *tstate = _PyThreadState_GET();
PyCodeObject *code_obj = (PyCodeObject *)code;
Py_INCREF(code_obj);
PyCodeObject *code_obj = (PyCodeObject *)Py_NewRef(code);
PyObject *name = code_obj->co_name;
assert(name != NULL);