@@ -531,7 +531,7 @@ public class PySessionDisposedException: Exception
531
531
{
532
532
533
533
}
534
-
534
+
535
535
public class PyScope : IDisposable
536
536
{
537
537
public class GILState : IDisposable
@@ -698,7 +698,7 @@ public PyObject ImportAs(string name, string asname)
698
698
public PyObject Execute ( PyObject script )
699
699
{
700
700
IntPtr ptr = Runtime . PyEval_EvalCode ( script . Handle , globals , locals ) ;
701
- Py . Throw ( ) ;
701
+ Runtime . CheckExceptionOccurred ( ) ;
702
702
if ( ptr == Runtime . PyNone )
703
703
{
704
704
Runtime . XDecref ( ptr ) ;
@@ -728,7 +728,7 @@ public PyObject Compile(string code, string filename = "", RunFlagType mode = Ru
728
728
{
729
729
IntPtr flag = ( IntPtr ) mode ;
730
730
IntPtr ptr = Runtime . Py_CompileString ( code , filename , flag ) ;
731
- Py . Throw ( ) ;
731
+ Runtime . CheckExceptionOccurred ( ) ;
732
732
return new PyObject ( ptr ) ;
733
733
}
734
734
@@ -746,7 +746,7 @@ public PyObject Eval(string code)
746
746
IntPtr ptr = Runtime . PyRun_String (
747
747
code , flag , globals , locals
748
748
) ;
749
- Py . Throw ( ) ;
749
+ Runtime . CheckExceptionOccurred ( ) ;
750
750
return new PyObject ( ptr ) ;
751
751
}
752
752
@@ -774,14 +774,14 @@ public void Exec(string code)
774
774
this . AcquireLock ( ) ;
775
775
Exec ( code , this . globals , this . locals ) ;
776
776
}
777
-
777
+
778
778
private void Exec ( string code , IntPtr _globals , IntPtr _locals )
779
779
{
780
780
var flag = ( IntPtr ) Runtime . Py_file_input ;
781
781
IntPtr ptr = Runtime . PyRun_String (
782
782
code , flag , _globals , _locals
783
783
) ;
784
- Py . Throw ( ) ;
784
+ Runtime . CheckExceptionOccurred ( ) ;
785
785
if ( ptr != Runtime . PyNone )
786
786
{
787
787
throw new PythonException ( ) ;
0 commit comments