Skip to content

Commit 7ebd6e4

Browse files
committed
Fix: transfer also BuiltinMethodDescriptor from PythonBuiltinClass#slots -> PBCT#slots
1 parent 31a01dd commit 7ebd6e4

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/SpecialMethodSlot.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ private static void initializeBuiltinTypeSlotsImpl(PythonCore core) {
284284
if (info != null) {
285285
typeSlots[slot.ordinal()] = info;
286286
}
287-
} else if (PythonLanguage.canCache(value)) {
287+
} else if (value instanceof BuiltinMethodDescriptor || PythonLanguage.canCache(value)) {
288288
typeSlots[slot.ordinal()] = value;
289289
}
290290
}
@@ -673,14 +673,16 @@ public static boolean checkSlotOverrides(PythonCore core) {
673673
Object typeValue = slot.getValue(type);
674674
if (typeValue != null) {
675675
Object klassValue = slot.getValue(klass);
676-
if (typeValue instanceof BuiltinMethodDescriptor) {
677-
if (!(klassValue instanceof PBuiltinFunction) ||
678-
((BuiltinMethodDescriptor) typeValue).getFactory() != ((PBuiltinFunction) klassValue).getBuiltinNodeFactory()) {
679-
mismatches.add(type.getName() + "." + slot.getName());
680-
}
681-
} else if (!typeValue.equals(klassValue)) {
682-
mismatches.add(type.getName() + "." + slot.getName());
676+
if (klassValue.equals(typeValue)) {
677+
// values are same: OK
678+
continue;
683679
}
680+
if (typeValue instanceof BuiltinMethodDescriptor && klassValue instanceof PBuiltinFunction &&
681+
((BuiltinMethodDescriptor) typeValue).getFactory() == ((PBuiltinFunction) klassValue).getBuiltinNodeFactory()) {
682+
// BuiltinMethodDescriptor and matching PBuiltinFunction: OK
683+
continue;
684+
}
685+
mismatches.add(type.getName() + "." + slot.getName());
684686
}
685687
}
686688
}

0 commit comments

Comments
 (0)