@@ -531,7 +531,7 @@ public class PySessionDisposedException: Exception
531531 {
532532
533533 }
534-
534+
535535 public class PyScope : IDisposable
536536 {
537537 public class GILState : IDisposable
@@ -698,7 +698,7 @@ public PyObject ImportAs(string name, string asname)
698698 public PyObject Execute ( PyObject script )
699699 {
700700 IntPtr ptr = Runtime . PyEval_EvalCode ( script . Handle , globals , locals ) ;
701- Py . Throw ( ) ;
701+ Runtime . CheckExceptionOccurred ( ) ;
702702 if ( ptr == Runtime . PyNone )
703703 {
704704 Runtime . XDecref ( ptr ) ;
@@ -728,7 +728,7 @@ public PyObject Compile(string code, string filename = "", RunFlagType mode = Ru
728728 {
729729 IntPtr flag = ( IntPtr ) mode ;
730730 IntPtr ptr = Runtime . Py_CompileString ( code , filename , flag ) ;
731- Py . Throw ( ) ;
731+ Runtime . CheckExceptionOccurred ( ) ;
732732 return new PyObject ( ptr ) ;
733733 }
734734
@@ -746,7 +746,7 @@ public PyObject Eval(string code)
746746 IntPtr ptr = Runtime . PyRun_String (
747747 code , flag , globals , locals
748748 ) ;
749- Py . Throw ( ) ;
749+ Runtime . CheckExceptionOccurred ( ) ;
750750 return new PyObject ( ptr ) ;
751751 }
752752
@@ -774,14 +774,14 @@ public void Exec(string code)
774774 this . AcquireLock ( ) ;
775775 Exec ( code , this . globals , this . locals ) ;
776776 }
777-
777+
778778 private void Exec ( string code , IntPtr _globals , IntPtr _locals )
779779 {
780780 var flag = ( IntPtr ) Runtime . Py_file_input ;
781781 IntPtr ptr = Runtime . PyRun_String (
782782 code , flag , _globals , _locals
783783 ) ;
784- Py . Throw ( ) ;
784+ Runtime . CheckExceptionOccurred ( ) ;
785785 if ( ptr != Runtime . PyNone )
786786 {
787787 throw new PythonException ( ) ;
0 commit comments