Skip to content

Commit

Permalink
Fix for Mono
Browse files Browse the repository at this point in the history
  • Loading branch information
BCSharp committed Dec 2, 2024
1 parent b6a28dc commit 291806b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Src/IronPython/Runtime/Operations/ArrayOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,10 @@ private static Array GetSlice(Array data, Slice slice) {
return Array.CreateInstance(data.GetType().GetElementType()!, 0);
}

if (step == 1) {
if (step == 1 && (!ClrModule.IsMono || data.GetLowerBound(0) == 0)) {
int n = stop - start;
Array ret = Array.CreateInstance(data.GetType().GetElementType()!, n);
Array.Copy(data, start, ret, 0, n);
Array.Copy(data, start, ret, 0, n); // doesn't work OK on Mono with non-0-based arrays
return ret;
} else {
int n = PythonOps.GetSliceCount(start, stop, step);
Expand Down

0 comments on commit 291806b

Please sign in to comment.