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

Commit46b6cda

Browse files
committed
Rebased update
1 parent49af0cd commit46b6cda

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

‎src/runtime/pythonengine.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ public class PySessionDisposedException: Exception
502502
{
503503

504504
}
505-
505+
506506
publicclassPyScope:IDisposable
507507
{
508508
publicclassGILState:IDisposable
@@ -669,7 +669,7 @@ public PyObject ImportAs(string name, string asname)
669669
publicPyObjectExecute(PyObjectscript)
670670
{
671671
IntPtrptr=Runtime.PyEval_EvalCode(script.Handle,globals,locals);
672-
Py.Throw();
672+
Runtime.CheckExceptionOccurred();
673673
if(ptr==Runtime.PyNone)
674674
{
675675
Runtime.XDecref(ptr);
@@ -699,7 +699,7 @@ public PyObject Compile(string code, string filename = "", RunFlagType mode = Ru
699699
{
700700
IntPtrflag=(IntPtr)mode;
701701
IntPtrptr=Runtime.Py_CompileString(code,filename,flag);
702-
Py.Throw();
702+
Runtime.CheckExceptionOccurred();
703703
returnnewPyObject(ptr);
704704
}
705705

@@ -717,7 +717,7 @@ public PyObject Eval(string code)
717717
IntPtrptr=Runtime.PyRun_String(
718718
code,flag,globals,locals
719719
);
720-
Py.Throw();
720+
Runtime.CheckExceptionOccurred();
721721
returnnewPyObject(ptr);
722722
}
723723

@@ -745,14 +745,14 @@ public void Exec(string code)
745745
this.AcquireLock();
746746
Exec(code,this.globals,this.locals);
747747
}
748-
748+
749749
privatevoidExec(stringcode,IntPtr_globals,IntPtr_locals)
750750
{
751751
varflag=(IntPtr)Runtime.Py_file_input;
752752
IntPtrptr=Runtime.PyRun_String(
753753
code,flag,_globals,_locals
754754
);
755-
Py.Throw();
755+
Runtime.CheckExceptionOccurred();
756756
if(ptr!=Runtime.PyNone)
757757
{
758758
thrownewPythonException();

‎src/runtime/runtime.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,10 +760,8 @@ internal static extern void Py_SetPath(
760760
[DllImport(PythonDll)]
761761
internalstaticexternIntPtr PyRun_String(stringcode,IntPtrst,IntPtrglobals,IntPtrlocals);
762762

763-
[DllImport(PythonDll,CallingConvention=CallingConvention.Cdecl,
764-
ExactSpelling=true,CharSet=CharSet.Ansi)]
765-
internal unsafestaticexternIntPtr
766-
PyEval_EvalCode(IntPtrco,IntPtrglobals,IntPtrlocals);
763+
[DllImport(PythonDll)]
764+
internalstaticexternIntPtr PyEval_EvalCode(IntPtrco,IntPtrglobals,IntPtrlocals);
767765

768766
[DllImport(PythonDll)]
769767
internalstaticexternIntPtr Py_CompileString(stringcode,stringfile,IntPtrtok);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp