diff --git a/mypyc/lib-rt/dict_ops.c b/mypyc/lib-rt/dict_ops.c index 5c6f31bf6f15..3680ce905aa1 100644 --- a/mypyc/lib-rt/dict_ops.c +++ b/mypyc/lib-rt/dict_ops.c @@ -274,6 +274,7 @@ char CPyDict_Clear(PyObject *dict) { if (res == NULL) { return 0; } + Py_DECREF(res); } return 1; } diff --git a/mypyc/lib-rt/list_ops.c b/mypyc/lib-rt/list_ops.c index ebfdafdb2ef4..ae1bc0cb1e6e 100644 --- a/mypyc/lib-rt/list_ops.c +++ b/mypyc/lib-rt/list_ops.c @@ -37,6 +37,7 @@ char CPyList_Clear(PyObject *list) { if (res == NULL) { return 0; } + Py_DECREF(res); } return 1; }