Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions src/DynamoUtilities/DataMarshaler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ public object Marshal(object obj)

var targetType = obj.GetType();

// TODO: Remove this conversion after updating IronPython version in 2.1
// in which IronPython will support Int64
if (typeof (long) == targetType)
{
obj = Convert.ToInt32(obj);
targetType = obj.GetType();
}

Converter<object, object> marshaler;
if (marshalers.TryGetValue(targetType, out marshaler) || cache.TryGetValue(targetType, out marshaler))
return marshaler(obj);
Expand Down
18 changes: 17 additions & 1 deletion test/Libraries/DynamoPythonTests/PythonEvalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,21 @@ public void DataMarshaling_Input()

Assert.AreEqual(3, output);
}
}

[Test]
public void SliceOperator_Output()
{
var names = new ArrayList { "indx" };
var vals = new ArrayList { 3 };

var output = DSIronPython.IronPythonEvaluator.EvaluateIronPythonScript(
"OUT = [1,2,3,4,5,6,7][indx:indx+2]",
names,
vals);

var expected = new ArrayList { 4, 5 };

Assert.AreEqual(expected, output);
}
}
}