File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -36,5 +36,33 @@ public static void StartAndStopTwice()
36
36
PythonEngine . Initialize ( ) ;
37
37
PythonEngine . Shutdown ( ) ;
38
38
}
39
+
40
+ [ Test ]
41
+ [ Ignore ( "System.OverflowException : Arithmetic operation resulted in an overflow" ) ]
42
+ //[Ignore("System.ArgumentException : Cannot pass a GCHandle across AppDomains")]
43
+ public void ReInitialize ( )
44
+ {
45
+ string code = "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
+ }
39
67
}
40
68
}
You can’t perform that action at this time.
0 commit comments