diff options
| author | Victor Stinner <vstinner@python.org> | 2022-11-10 09:03:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-10 09:03:39 +0100 |
| commit | d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20 (patch) | |
| tree | 7055b2d966bf41e636751177cea0248b56072e92 /Python/symtable.c | |
| parent | f883b7f8ee3209b52863fc662343c8cd81abdc59 (diff) | |
| download | cpython-git-d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20.tar.gz | |
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.
Diffstat (limited to 'Python/symtable.c')
| -rw-r--r-- | Python/symtable.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index ea195bc155..9bb7ffa92c 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -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)); |
