Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rebased
  • Loading branch information
yagweb committed Apr 7, 2017
commit 9f50e25dda9b3a30f1cea594bdfbe133d756c60b
4 changes: 2 additions & 2 deletions src/embed_tests/pyscope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void TestCompileExpression()
{
ps.SetVariable("bb", 100); //declare a global variable
ps.SetVariable("cc", 10); //declare a local variable
var script = ps.Compile("bb+cc+3", "", CompileMode.Eval);
var script = ps.Compile("bb+cc+3", "", RunFlagType.Eval);
var result = ps.Execute<int>(script);
Assert.AreEqual(result, 113);
}
Expand All @@ -68,7 +68,7 @@ public void TestCompileStatements()
{
ps.SetVariable("bb", 100); //declare a global variable
ps.SetVariable("cc", 10); //declare a local variable
var script = ps.Compile("aa=bb+cc+3", "", CompileMode.File);
var script = ps.Compile("aa=bb+cc+3", "", RunFlagType.File);
ps.Execute(script);
int result = ps.GetVariable<int>("aa");
Assert.AreEqual(result, 113);
Expand Down
11 changes: 2 additions & 9 deletions src/runtime/pythonengine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,7 @@ public class PySessionDisposedException: Exception
{

}

public enum CompileMode
{
Single = 256,
File = 257,
Eval = 258
}


public class PyScope : IDisposable
{
public class GILState : IDisposable
Expand Down Expand Up @@ -731,7 +724,7 @@ public T Execute<T>(PyObject script)
/// <remarks>
/// Compile Python expression/statements into ast.
/// </remarks>
public PyObject Compile(string code, string filename = "", CompileMode mode = CompileMode.File)
public PyObject Compile(string code, string filename = "", RunFlagType mode = RunFlagType.File)
{
IntPtr flag = (IntPtr)mode;
IntPtr ptr = Runtime.Py_CompileString(code, filename, flag);
Expand Down