Skip to content

Cleaning up public API #1557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/embed_tests/TestConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void CovertTypeError()
[Test]
public void ConvertOverflow()
{
using (var num = new PyLong(ulong.MaxValue))
using (var num = new PyInt(ulong.MaxValue))
{
IntPtr largeNum = PyRuntime.PyNumber_Add(num.Handle, num.Handle);
try
Expand Down
8 changes: 4 additions & 4 deletions src/embed_tests/TestFinalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void CollectBasicObject()
};

Assert.IsFalse(called, "The event handler was called before it was installed");
Finalizer.Instance.CollectOnce += handler;
Finalizer.Instance.BeforeCollect += handler;

IntPtr pyObj = MakeAGarbage(out var shortWeak, out var longWeak);
FullGCCollect();
Expand Down Expand Up @@ -81,7 +81,7 @@ public void CollectBasicObject()
}
finally
{
Finalizer.Instance.CollectOnce -= handler;
Finalizer.Instance.BeforeCollect -= handler;
}
Assert.IsTrue(called, "The event handler was not called during finalization");
Assert.GreaterOrEqual(objectCount, 1);
Expand Down Expand Up @@ -121,7 +121,7 @@ private static IntPtr MakeAGarbage(out WeakReference shortWeak, out WeakReferenc
IntPtr handle = IntPtr.Zero;
WeakReference @short = null, @long = null;
// must create Python object in the thread where we have GIL
IntPtr val = PyLong.FromLong(1024);
IntPtr val = Runtime.Runtime.PyLong_FromLongLong(1024).DangerousMoveToPointerOrNull();
// must create temp object in a different thread to ensure it is not present
// when conservatively scanning stack for GC roots.
// see https://xamarin.github.io/bugzilla-archives/17/17593/bug.html
Expand Down Expand Up @@ -234,7 +234,7 @@ private static IntPtr CreateStringGarbage()
{
PyString s1 = new PyString("test_string");
// s2 steal a reference from s1
PyString s2 = new PyString(s1.Handle);
PyString s2 = new PyString(StolenReference.DangerousFromPointer(s1.Handle));
return s1.Handle;
}
}
Expand Down
97 changes: 0 additions & 97 deletions src/embed_tests/TestPyAnsiString.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/embed_tests/TestPyFloat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ public void Dispose()
PythonEngine.Shutdown();
}

[Test]
public void IntPtrCtor()
{
var i = new PyFloat(1);
Runtime.Runtime.XIncref(i.Handle);
var ii = new PyFloat(i.Handle);
Assert.AreEqual(i.Handle, ii.Handle);
}

[Test]
public void FloatCtor()
{
Expand Down
14 changes: 3 additions & 11 deletions src/embed_tests/TestPyInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,6 @@ public void TestCtorSByte()
Assert.AreEqual(i, a.ToInt32());
}

[Test]
public void TestCtorPtr()
{
var i = new PyInt(5);
Runtime.Runtime.XIncref(i.Handle);
var a = new PyInt(i.Handle);
Assert.AreEqual(5, a.ToInt32());
}

[Test]
public void TestCtorPyObject()
{
Expand Down Expand Up @@ -184,9 +175,10 @@ public void TestConvertToInt16()
[Test]
public void TestConvertToInt64()
{
var a = new PyInt(5);
long val = 5 + (long)int.MaxValue;
var a = new PyInt(val);
Assert.IsInstanceOf(typeof(long), a.ToInt64());
Assert.AreEqual(5, a.ToInt64());
Assert.AreEqual(val, a.ToInt64());
}
}
}
208 changes: 0 additions & 208 deletions src/embed_tests/TestPyLong.cs

This file was deleted.

Loading