Skip to content

Commit 8083f0f

Browse files
cosminbascatomasstupka
authored andcommitted
Dir builtin: make sure we return a (sorted) PList
1 parent 646349e commit 8083f0f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,10 @@ Object locals(VirtualFrame frame, @SuppressWarnings("unused") Object object,
499499
@Specialization(guards = "!isNoValue(object)")
500500
Object dir(VirtualFrame frame, Object object,
501501
@Cached ListBuiltins.ListSortNode sortNode,
502+
@Cached ListNodes.ConstructListNode constructListNode,
502503
@Cached("create(__DIR__)") LookupAndCallUnaryNode dirNode) {
503-
Object list = dirNode.executeObject(frame, object);
504-
if (list instanceof PList) {
505-
sortNode.sort(frame, (PList) list);
506-
}
504+
PList list = constructListNode.execute(dirNode.executeObject(frame, object));
505+
sortNode.sort(frame, list);
507506
return list;
508507
}
509508
}

0 commit comments

Comments
 (0)