mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
gh-99300: Use Py_NewRef() in Python/ directory (#99302)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
This commit is contained in:
parent
f883b7f8ee
commit
d8f239d86e
14 changed files with 41 additions and 80 deletions
|
@ -74,8 +74,7 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
|
|||
ste->ste_table = st;
|
||||
ste->ste_id = k; /* ste owns reference to k */
|
||||
|
||||
Py_INCREF(name);
|
||||
ste->ste_name = name;
|
||||
ste->ste_name = Py_NewRef(name);
|
||||
|
||||
ste->ste_symbols = NULL;
|
||||
ste->ste_varnames = NULL;
|
||||
|
@ -286,8 +285,7 @@ _PySymtable_Build(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
|
|||
_PySymtable_Free(st);
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(filename);
|
||||
st->st_filename = filename;
|
||||
st->st_filename = Py_NewRef(filename);
|
||||
st->st_future = future;
|
||||
|
||||
/* Setup recursion depth check counters */
|
||||
|
@ -1949,8 +1947,7 @@ symtable_visit_alias(struct symtable *st, alias_ty a)
|
|||
return 0;
|
||||
}
|
||||
else {
|
||||
store_name = name;
|
||||
Py_INCREF(store_name);
|
||||
store_name = Py_NewRef(name);
|
||||
}
|
||||
if (!_PyUnicode_EqualToASCIIString(name, "*")) {
|
||||
int r = symtable_add_def(st, store_name, DEF_IMPORT, LOCATION(a));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue