Skip to content

Commit 247e2d9

Browse files
committed
Fix ref count error
1 parent cee8e17 commit 247e2d9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/embed_tests/TestPyInt.cs

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public void TestCtorSByte()
8686
public void TestCtorPtr()
8787
{
8888
var i = new PyInt(5);
89+
Runtime.Runtime.XIncref(i.Handle);
8990
var a = new PyInt(i.Handle);
9091
Assert.AreEqual(5, a.ToInt32());
9192
}
@@ -94,6 +95,7 @@ public void TestCtorPtr()
9495
public void TestCtorPyObject()
9596
{
9697
var i = new PyInt(5);
98+
Runtime.Runtime.XIncref(i.Handle);
9799
var a = new PyInt(i);
98100
Assert.AreEqual(5, a.ToInt32());
99101
}

src/embed_tests/TestPyLong.cs

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public void TestCtorDouble()
102102
public void TestCtorPtr()
103103
{
104104
var i = new PyLong(5);
105+
Runtime.Runtime.XIncref(i.Handle);
105106
var a = new PyLong(i.Handle);
106107
Assert.AreEqual(5, a.ToInt32());
107108
}
@@ -110,6 +111,7 @@ public void TestCtorPtr()
110111
public void TestCtorPyObject()
111112
{
112113
var i = new PyLong(5);
114+
Runtime.Runtime.XIncref(i.Handle);
113115
var a = new PyLong(i);
114116
Assert.AreEqual(5, a.ToInt32());
115117
}

0 commit comments

Comments
 (0)