Skip to content

Commit

Permalink
added support to marshall input lists to python lists
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Dec 7, 2023
1 parent d9b26c5 commit 18c55fc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/runtime/McNeel.PythonEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -563,6 +564,18 @@ PyModule PrepareScope(string scopeName, string pythonFile)
pyscope.Set("__file__", pythonFile ?? string.Empty);
return pyscope;
}
#endregion

#region Marshalling
public object MarshInputList(IEnumerable enumerable)
{
PyList pyList = new PyList();

foreach (object obj in enumerable)
pyList.Append(PyObject.FromManagedObject(obj));

return pyList;
}

public object MarshOutput(object value)
{
Expand Down

0 comments on commit 18c55fc

Please sign in to comment.