X Tutup
Skip to content
Closed
Changes from all commits
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
21 changes: 11 additions & 10 deletions src/runtime/converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ internal static IntPtr ToPython(Object value, Type type) {
}
}

if (value is IEnumerable) {
using (var resultlist = new PyList()) {
foreach (object o in (IEnumerable)value) {
using (var p = new PyObject(ToPython(o, o.GetType())))
resultlist.Append(p);
}
Runtime.Incref(resultlist.Handle);
return resultlist.Handle;
}
}

return result;

case TypeCode.String:
Expand Down Expand Up @@ -174,16 +185,6 @@ internal static IntPtr ToPython(Object value, Type type) {
return Runtime.PyLong_FromUnsignedLongLong((ulong)value);

default:
if (value is IEnumerable) {
using (var resultlist = new PyList()) {
foreach (object o in (IEnumerable)value) {
using (var p = new PyObject(ToPython(o, o.GetType())))
resultlist.Append(p);
}
Runtime.Incref(resultlist.Handle);
return resultlist.Handle;
}
}
result = CLRObject.GetInstHandle(value, type);
return result;
}
Expand Down
X Tutup