File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ private static void initializeBuiltinTypeSlotsImpl(PythonCore core) {
284
284
if (info != null ) {
285
285
typeSlots [slot .ordinal ()] = info ;
286
286
}
287
- } else if (PythonLanguage .canCache (value )) {
287
+ } else if (value instanceof BuiltinMethodDescriptor || PythonLanguage .canCache (value )) {
288
288
typeSlots [slot .ordinal ()] = value ;
289
289
}
290
290
}
@@ -673,14 +673,16 @@ public static boolean checkSlotOverrides(PythonCore core) {
673
673
Object typeValue = slot .getValue (type );
674
674
if (typeValue != null ) {
675
675
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 ;
683
679
}
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 ());
684
686
}
685
687
}
686
688
}
You can’t perform that action at this time.
0 commit comments