Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0fb3f2

Browse files
yagwebvmuriart
authored andcommitted
Add unittest for Overflow/across AppDomains Exceptions reproduction (#393)
First exception shows issue from#376
1 parentf6d176c commitc0fb3f2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎src/embed_tests/pyinitialize.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,33 @@ public static void StartAndStopTwice()
3636
PythonEngine.Initialize();
3737
PythonEngine.Shutdown();
3838
}
39+
40+
[Test]
41+
[Ignore("System.OverflowException : Arithmetic operation resulted in an overflow")]
42+
//[Ignore("System.ArgumentException : Cannot pass a GCHandle across AppDomains")]
43+
publicvoidReInitialize()
44+
{
45+
stringcode="from System import Int32\n";
46+
PythonEngine.Initialize();
47+
using(Py.GIL())
48+
{
49+
//import any class or struct from .NET
50+
PythonEngine.RunSimpleString(code);
51+
}
52+
PythonEngine.Shutdown();
53+
54+
PythonEngine.Initialize();
55+
using(Py.GIL())
56+
{
57+
//Import a class/struct from .NET
58+
//This class/struct must be imported during the first initialization.
59+
PythonEngine.RunSimpleString(code);
60+
//Create an instance of the class/struct
61+
//System.OverflowException Exception will be raised here.
62+
//If replacing int with Int64, OverflowException will be replaced with AppDomain exception.
63+
PythonEngine.RunSimpleString("Int32(1)");
64+
}
65+
PythonEngine.Shutdown();
66+
}
3967
}
4068
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp