mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +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
|
@ -47,9 +47,8 @@ PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname
|
|||
|
||||
PyCodeObject *code_obj = (PyCodeObject *)Py_NewRef(code);
|
||||
|
||||
PyObject *name = code_obj->co_name;
|
||||
assert(name != NULL);
|
||||
Py_INCREF(name);
|
||||
assert(code_obj->co_name != NULL);
|
||||
PyObject *name = Py_NewRef(code_obj->co_name);
|
||||
|
||||
if (!qualname) {
|
||||
qualname = code_obj->co_qualname;
|
||||
|
@ -525,10 +524,7 @@ func_get_annotations(PyFunctionObject *op, void *Py_UNUSED(ignored))
|
|||
return NULL;
|
||||
}
|
||||
PyObject *d = func_get_annotation_dict(op);
|
||||
if (d) {
|
||||
Py_INCREF(d);
|
||||
}
|
||||
return d;
|
||||
return Py_XNewRef(d);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue