summaryrefslogtreecommitdiff
path: root/Objects/genobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r--Objects/genobject.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 3e0e075097..6661e3fb94 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -341,8 +341,7 @@ _PyGen_yf(PyGenObject *gen)
/* Not in a yield from */
return NULL;
}
- yf = _PyFrame_StackPeek(frame);
- Py_INCREF(yf);
+ yf = Py_NewRef(_PyFrame_StackPeek(frame));
}
return yf;
@@ -494,8 +493,7 @@ throw_here:
/* Normalize to raise <class>, <instance> */
Py_XDECREF(val);
val = typ;
- typ = PyExceptionInstance_Class(typ);
- Py_INCREF(typ);
+ typ = Py_NewRef(PyExceptionInstance_Class(typ));
if (tb == NULL)
/* Returns NULL if there's no traceback */