Skip to content

Commit 22610a2

Browse files
authored
[mypyc] Fix refleak in str index (#21251)
1 parent 06c9e27 commit 22610a2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

mypyc/lib-rt/str_ops.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ PyObject *CPyStr_GetItem(PyObject *str, CPyTagged index) {
131131
}
132132
} else {
133133
PyObject *index_obj = CPyTagged_AsObject(index);
134-
return PyObject_GetItem(str, index_obj);
134+
PyObject *result = PyObject_GetItem(str, index_obj);
135+
Py_DECREF(index_obj);
136+
return result;
135137
}
136138
}
137139

0 commit comments

Comments
 (0)