Skip to content

Commit

Permalink
index setter was leaking memory
Browse files Browse the repository at this point in the history
  • Loading branch information
lostmsu committed Dec 18, 2024
1 parent fe01712 commit 4eafbfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions src/runtime/Types/ClassBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,8 @@ static int mp_ass_subscript_impl(BorrowedReference ob, BorrowedReference idx, Bo
// Add value to argument list
Runtime.PyTuple_SetItem(real.Borrow(), i, v);

cls.indexer.SetItem(ob, real.Borrow());

if (Exceptions.ErrorOccurred())
{
return -1;
}

return 0;
using var result = cls.indexer.SetItem(ob, real.Borrow());
return result.IsNull() ? -1 : 0;
}

static NewReference tp_call_impl(BorrowedReference ob, BorrowedReference args, BorrowedReference kw)
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/Types/Indexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ internal NewReference GetItem(BorrowedReference inst, BorrowedReference args)
}


internal void SetItem(BorrowedReference inst, BorrowedReference args)
internal NewReference SetItem(BorrowedReference inst, BorrowedReference args)
{
SetterBinder.Invoke(inst, args, null);
return SetterBinder.Invoke(inst, args, null);
}

internal bool NeedsDefaultArgs(BorrowedReference args)
Expand Down

0 comments on commit 4eafbfa

Please sign in to comment.