@@ -502,7 +502,7 @@ public class PySessionDisposedException: Exception
502
502
{
503
503
504
504
}
505
-
505
+
506
506
public class PyScope : IDisposable
507
507
{
508
508
public class GILState : IDisposable
@@ -669,7 +669,7 @@ public PyObject ImportAs(string name, string asname)
669
669
public PyObject Execute ( PyObject script )
670
670
{
671
671
IntPtr ptr = Runtime . PyEval_EvalCode ( script . Handle , globals , locals ) ;
672
- Py . Throw ( ) ;
672
+ Runtime . CheckExceptionOccurred ( ) ;
673
673
if ( ptr == Runtime . PyNone )
674
674
{
675
675
Runtime . XDecref ( ptr ) ;
@@ -699,7 +699,7 @@ public PyObject Compile(string code, string filename = "", RunFlagType mode = Ru
699
699
{
700
700
IntPtr flag = ( IntPtr ) mode ;
701
701
IntPtr ptr = Runtime . Py_CompileString ( code , filename , flag ) ;
702
- Py . Throw ( ) ;
702
+ Runtime . CheckExceptionOccurred ( ) ;
703
703
return new PyObject ( ptr ) ;
704
704
}
705
705
@@ -717,7 +717,7 @@ public PyObject Eval(string code)
717
717
IntPtr ptr = Runtime . PyRun_String (
718
718
code , flag , globals , locals
719
719
) ;
720
- Py . Throw ( ) ;
720
+ Runtime . CheckExceptionOccurred ( ) ;
721
721
return new PyObject ( ptr ) ;
722
722
}
723
723
@@ -745,14 +745,14 @@ public void Exec(string code)
745
745
this . AcquireLock ( ) ;
746
746
Exec ( code , this . globals , this . locals ) ;
747
747
}
748
-
748
+
749
749
private void Exec ( string code , IntPtr _globals , IntPtr _locals )
750
750
{
751
751
var flag = ( IntPtr ) Runtime . Py_file_input ;
752
752
IntPtr ptr = Runtime . PyRun_String (
753
753
code , flag , _globals , _locals
754
754
) ;
755
- Py . Throw ( ) ;
755
+ Runtime . CheckExceptionOccurred ( ) ;
756
756
if ( ptr != Runtime . PyNone )
757
757
{
758
758
throw new PythonException ( ) ;
0 commit comments