Skip to content

Commit 57d7779

Browse files
committed
fix potential double free
1 parent 3043201 commit 57d7779

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/embed_tests/Codecs.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,9 @@ public void SequenceDecoderTest()
218218
Assert.IsFalse(codec.CanDecode(fooType, typeof(ICollection<int>)));
219219

220220
//python tuples do satisfy the python sequence protocol
221-
var pyTuple = new PyObject(Runtime.PyTuple_New(3));
221+
var pyTuple = new PyTuple(items.ToArray());
222222
var pyTupleType = pyTuple.GetPythonType();
223223

224-
Runtime.PyTuple_SetItem(pyTuple.Handle, 0, items[0].Handle);
225-
Runtime.PyTuple_SetItem(pyTuple.Handle, 1, items[1].Handle);
226-
Runtime.PyTuple_SetItem(pyTuple.Handle, 2, items[2].Handle);
227-
228224
Assert.IsTrue(codec.CanDecode(pyTupleType, typeof(ICollection<float>)));
229225
Assert.IsTrue(codec.CanDecode(pyTupleType, typeof(ICollection<int>)));
230226
Assert.IsTrue(codec.CanDecode(pyTupleType, typeof(ICollection<string>)));

0 commit comments

Comments
 (0)