Skip to content

Commit ac605fd

Browse files
committed
index setter was leaking memory
1 parent a674658 commit ac605fd

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/runtime/Types/ClassBase.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,8 @@ static int mp_ass_subscript_impl(BorrowedReference ob, BorrowedReference idx, Bo
497497
// Add value to argument list
498498
Runtime.PyTuple_SetItem(real.Borrow(), i, v);
499499

500-
cls.indexer.SetItem(ob, real.Borrow());
501-
502-
if (Exceptions.ErrorOccurred())
503-
{
504-
return -1;
505-
}
506-
507-
return 0;
500+
using var result = cls.indexer.SetItem(ob, real.Borrow());
501+
return result.IsNull() ? -1 : 0;
508502
}
509503

510504
static NewReference tp_call_impl(BorrowedReference ob, BorrowedReference args, BorrowedReference kw)

src/runtime/Types/Indexer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ internal NewReference GetItem(BorrowedReference inst, BorrowedReference args)
5050
}
5151

5252

53-
internal void SetItem(BorrowedReference inst, BorrowedReference args)
53+
internal NewReference SetItem(BorrowedReference inst, BorrowedReference args)
5454
{
55-
SetterBinder.Invoke(inst, args, null);
55+
return SetterBinder.Invoke(inst, args, null);
5656
}
5757

5858
internal bool NeedsDefaultArgs(BorrowedReference args)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy