Good point. Also, shouldn't I be decref-ing op2_array, iter, and iter2 before returning successfully, like in the "fail" section? I think that's part of the reason for the memory leak, but when I add some decrefs here, python crashes during the finalize/gc stage after my test script runs.