mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
This commit is contained in:
parent
19c1462e8d
commit
8211cf5d28
18 changed files with 40 additions and 74 deletions
|
@ -1459,8 +1459,7 @@ merge_consts_recursive(PyObject *const_cache, PyObject *o)
|
|||
}
|
||||
PyObject *u;
|
||||
if (PyTuple_CheckExact(k)) {
|
||||
u = PyTuple_GET_ITEM(k, 1);
|
||||
Py_INCREF(u);
|
||||
u = Py_NewRef(PyTuple_GET_ITEM(k, 1));
|
||||
Py_DECREF(k);
|
||||
}
|
||||
else {
|
||||
|
@ -2732,8 +2731,7 @@ compiler_class(struct compiler *c, stmt_ty s)
|
|||
{
|
||||
location loc = LOCATION(firstlineno, firstlineno, 0, 0);
|
||||
/* use the class name for name mangling */
|
||||
Py_INCREF(s->v.ClassDef.name);
|
||||
Py_XSETREF(c->u->u_private, s->v.ClassDef.name);
|
||||
Py_XSETREF(c->u->u_private, Py_NewRef(s->v.ClassDef.name));
|
||||
/* load (global) __name__ ... */
|
||||
if (!compiler_nameop(c, loc, &_Py_ID(__name__), Load)) {
|
||||
compiler_exit_scope(c);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue