X Tutup
Skip to content

Commit ccf9560

Browse files
committed
Add a Py.Throw function.
Checks whether an error occurred and in case it has throws a PythonException.
1 parent 9af85fd commit ccf9560

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/runtime/pythonengine.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,5 +549,13 @@ public static void SetArgv(IEnumerable<string> argv)
549549
Runtime.PySys_SetArgvEx(arr.Length, arr, 0);
550550
}
551551
}
552+
553+
internal static void Throw()
554+
{
555+
if (Runtime.PyErr_Occurred() != 0)
556+
{
557+
throw new PythonException();
558+
}
559+
}
552560
}
553561
}

0 commit comments

Comments
 (0)
X Tutup