summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-16 17:34:24 (GMT)
committerGitHub <noreply@github.com>2022-11-16 17:34:24 (GMT)
commit8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b (patch)
tree510409237622aa30dfc6833602bdde97c578f2bb /Python/symtable.c
parent19c1462e8dca3319c8290e2edcce482bd18cb018 (diff)
downloadcpython-8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b.zip
cpython-8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b.tar.gz
cpython-8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b.tar.bz2
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 9bb7ffa..fb2bb7d 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -373,17 +373,17 @@ PySymtable_Lookup(struct symtable *st, void *key)
if (k == NULL)
return NULL;
v = PyDict_GetItemWithError(st->st_blocks, k);
+ Py_DECREF(k);
+
if (v) {
assert(PySTEntry_Check(v));
- Py_INCREF(v);
}
else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_KeyError,
"unknown symbol table entry");
}
- Py_DECREF(k);
- return (PySTEntryObject *)v;
+ return (PySTEntryObject *)Py_XNewRef(v);
}
long