Skip to content

Commit 92ba953

Browse files
committed
Fix: match expected order for open handles
1 parent b876637 commit 92ba953

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/GraalHPyDebugModuleBuiltins.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,12 @@ PList doInt(VirtualFrame frame, int generation,
134134
@TruffleBoundary
135135
private static Object[] getOpenDebugHandles(GraalHPyDebugContext debugContext, int generation) {
136136
ArrayList<GraalHPyHandle> openHandles = debugContext.getOpenHandles(generation);
137-
Object[] result = new Object[openHandles.size()];
137+
int n = openHandles.size();
138+
Object[] result = new Object[n];
138139
PythonObjectFactory factory = PythonObjectFactory.getUncached();
139-
for (int i = 0; i < result.length; i++) {
140-
result[i] = factory.createDebugHandle(openHandles.get(i));
140+
// do reverse order to match order expected by HPy tests
141+
for (int i = 0; i < n; i++) {
142+
result[n - 1 - i] = factory.createDebugHandle(openHandles.get(i));
141143
}
142144
return result;
143145
}

0 commit comments

Comments
 (0)