summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/compile.c b/Python/compile.c
index bd41ebc..9226bc2 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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);