Skip to content

Commit 76190ad

Browse files
committed
wip: ref counting fixes
1 parent b91d59b commit 76190ad

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Objects/frameobject.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,13 +1993,16 @@ frame_get_var(_PyInterpreterFrame *frame, PyCodeObject *co, int i,
19931993
assert(!_PyFrame_IsIncomplete(frame));
19941994
value = PyCell_GetRef((PyCellObject *)value);
19951995
}
1996-
// (likely) Otherwise it is an arg (kind & CO_FAST_LOCAL),
1997-
// with the initial value set when the frame was created...
1998-
// (unlikely) ...or it was set via the f_locals proxy.
1996+
else {
1997+
// (likely) Otherwise it is an arg (kind & CO_FAST_LOCAL),
1998+
// with the initial value set when the frame was created...
1999+
// (unlikely) ...or it was set via the f_locals proxy.
2000+
Py_INCREF(value);
2001+
}
19992002
}
20002003
}
20012004
else {
2002-
Py_INCREF(value);
2005+
Py_XINCREF(value);
20032006
}
20042007
}
20052008
*pvalue = value;

Objects/typeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11778,6 +11778,7 @@ super_init_impl(PyObject *self, PyTypeObject *type, PyObject *obj) {
1177811778
if (obj != NULL) {
1177911779
obj_type = supercheck(type, obj);
1178011780
if (obj_type == NULL) {
11781+
Py_DECREF(type);
1178111782
Py_DECREF(obj);
1178211783
return -1;
1178311784
}

0 commit comments

Comments
 (0)