Skip to content

Commit dc42221

Browse files
committed
gh-150942: Speed up FrameLocalsProxy.values()
1 parent 20e6c2f commit dc42221

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

Objects/frameobject.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,12 +593,10 @@ framelocalsproxy_values(PyObject *self, PyObject *Py_UNUSED(ignored))
593593
for (int i = 0; i < co->co_nlocalsplus; i++) {
594594
PyObject *value = framelocalsproxy_getval(frame->f_frame, co, i);
595595
if (value) {
596-
if (PyList_Append(values, value) < 0) {
596+
if (_PyList_AppendTakeRef((PyListObject *)values, value) < 0) {
597597
Py_DECREF(values);
598-
Py_DECREF(value);
599598
return NULL;
600599
}
601-
Py_DECREF(value);
602600
}
603601
}
604602

0 commit comments

Comments
 (0)