diff --git a/modules/packages/Python.chpl b/modules/packages/Python.chpl index 644a077e0f57..f3d517ba40d3 100644 --- a/modules/packages/Python.chpl +++ b/modules/packages/Python.chpl @@ -647,7 +647,7 @@ module Python { const idx = res.domain.orderToIndex(i); var elm = PySequence_GetItem(obj, i); this.checkException(); - defer Py_DECREF(elm); + this.toFree.pushBack(elm); res[idx] = fromPython(res.eltType, elm); this.checkException(); } @@ -666,7 +666,7 @@ module Python { for i in 0..