Skip to content

Commit 4209793

Browse files
committed
Fix: correctly dispatch to message w/o state
1 parent 5e259d4 commit 4209793

File tree

1 file changed

+6
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/dict

1 file changed

+6
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/dict/PDict.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,15 @@ static boolean hasBuiltinLen(PDict self, LookupInheritedAttributeNode.Dynamic lo
127127
}, limit = "1")
128128
static int doBuiltin(PDict self, ThreadState state,
129129
@CachedLibrary("self.getDictStorage()") HashingStorageLibrary storageLib,
130+
@Shared("gotState") @Cached ConditionProfile gotState,
130131
@SuppressWarnings("unused") @Cached IsBuiltinClassProfile profile,
131132
@SuppressWarnings("unused") @Cached LookupInheritedAttributeNode.Dynamic lookupSelf,
132133
@SuppressWarnings("unused") @Cached LookupAttributeInMRONode.Dynamic lookupDict) {
133-
return storageLib.lengthWithState(self.dictStorage, state);
134+
if (gotState.profile(state == null)) {
135+
return storageLib.length(self.dictStorage);
136+
} else {
137+
return storageLib.lengthWithState(self.dictStorage, state);
138+
}
134139
}
135140

136141
@Specialization(replaces = "doBuiltin")

0 commit comments

Comments
 (0)