117
117
import com .oracle .graal .python .nodes .attributes .WriteAttributeToObjectNode ;
118
118
import com .oracle .graal .python .nodes .call .special .CallBinaryMethodNode ;
119
119
import com .oracle .graal .python .nodes .call .special .CallUnaryMethodNode ;
120
- import com .oracle .graal .python .nodes .call .special .LookupAndCallBinaryNode ;
121
120
import com .oracle .graal .python .nodes .call .special .LookupSpecialMethodNode ;
122
121
import com .oracle .graal .python .nodes .classes .IsSubtypeNode ;
123
122
import com .oracle .graal .python .nodes .object .IsBuiltinClassProfile ;
@@ -691,7 +690,7 @@ static PythonAbstractClass doNative(PythonNativeClass obj,
691
690
692
691
@ ImportStatic (SpecialMethodNames .class )
693
692
@ GenerateUncached
694
- abstract static class GetBestBaseClassNode extends PNodeWithContext {
693
+ public abstract static class GetBestBaseClassNode extends PNodeWithContext {
695
694
696
695
static GetBestBaseClassNode create () {
697
696
return TypeNodesFactory .GetBestBaseClassNodeGen .create ();
@@ -750,7 +749,7 @@ private static Object bestBase(PythonAbstractClass[] bases, GetSolidBaseNode get
750
749
winner = candidate ;
751
750
base = basei ;
752
751
} else {
753
- throw raiseNode .raise (SystemError , ErrorMessages .MULTIPLE_BASES_LAYOUT_CONFLICT );
752
+ throw raiseNode .raise (TypeError , ErrorMessages .MULTIPLE_BASES_LAYOUT_CONFLICT );
754
753
}
755
754
}
756
755
return base ;
@@ -763,7 +762,6 @@ public abstract static class CheckCompatibleForAssigmentNode extends PNodeWithCo
763
762
@ Child private LookupAttributeInMRONode lookupSlotsNode ;
764
763
@ Child private LookupAttributeInMRONode lookupNewNode ;
765
764
@ Child private GetDictStorageNode getDictStorageNode ;
766
- @ Child private LookupAndCallBinaryNode getDictNode ;
767
765
@ Child private HashingStorageLibrary hashingStorageLib ;
768
766
@ Child private PythonObjectLibrary objectLibrary ;
769
767
@ Child private GetObjectArrayNode getObjectArrayNode ;
@@ -1012,35 +1010,35 @@ protected Object exec(Object type,
1012
1010
@ Cached CallBinaryMethodNode callGetAttr ,
1013
1011
@ Cached GetDictStorageNode getDictStorageNode ,
1014
1012
@ CachedLibrary (limit = "4" ) HashingStorageLibrary storageLibrary ,
1015
- @ Cached GetObjectArrayNode getObjectArrayNode ,
1016
1013
@ CachedLibrary (limit = "4" ) PythonObjectLibrary objectLibrary ) {
1017
- return solidBase (type , getBaseClassNode , context , lookupGetAttribute , callGetAttr , getDictStorageNode , storageLibrary , getObjectArrayNode , objectLibrary );
1014
+ return solidBase (type , getBaseClassNode , context , lookupGetAttribute , callGetAttr , getDictStorageNode , storageLibrary , objectLibrary );
1018
1015
}
1019
1016
1020
1017
private Object solidBase (Object type , GetBaseClassNode getBaseClassNode , PythonContext context , LookupSpecialMethodNode .Dynamic lookupGetAttribute ,
1021
- CallBinaryMethodNode callGetAttr , GetDictStorageNode getDictStorageNode , HashingStorageLibrary storageLibrary , GetObjectArrayNode getObjectArrayNode ,
1018
+ CallBinaryMethodNode callGetAttr , GetDictStorageNode getDictStorageNode , HashingStorageLibrary storageLibrary ,
1022
1019
PythonObjectLibrary objectLibrary ) {
1023
1020
Object base = getBaseClassNode .execute (type );
1024
1021
1025
1022
if (base != null ) {
1026
- base = solidBase (base , getBaseClassNode , context , lookupGetAttribute , callGetAttr , getDictStorageNode , storageLibrary , getObjectArrayNode , objectLibrary );
1023
+ base = solidBase (base , getBaseClassNode , context , lookupGetAttribute , callGetAttr , getDictStorageNode , storageLibrary , objectLibrary );
1027
1024
} else {
1028
1025
base = context .getCore ().lookupType (PythonBuiltinClassType .PythonObject );
1029
1026
}
1030
1027
1031
- if (extraivars (type , base , lookupGetAttribute , callGetAttr , getDictStorageNode , storageLibrary , getObjectArrayNode , objectLibrary )) {
1028
+ if (type != base && extraivars (type , base , lookupGetAttribute , callGetAttr , getDictStorageNode , storageLibrary , objectLibrary )) {
1032
1029
return type ;
1033
1030
} else {
1034
1031
return base ;
1035
1032
}
1036
1033
}
1037
1034
1038
1035
private boolean extraivars (Object type , Object base , LookupSpecialMethodNode .Dynamic lookupGetAttribute , CallBinaryMethodNode callGetAttr ,
1039
- GetDictStorageNode getDictStorageNode , HashingStorageLibrary storageLibrary , GetObjectArrayNode getObjectArrayNode , PythonObjectLibrary objectLibrary ) {
1036
+ GetDictStorageNode getDictStorageNode , HashingStorageLibrary storageLibrary , PythonObjectLibrary objectLibrary ) {
1040
1037
Object typeSlots = getSlotsFromDict (type , lookupGetAttribute , callGetAttr , getDictStorageNode , storageLibrary );
1041
1038
Object baseSlots = getSlotsFromDict (base , lookupGetAttribute , callGetAttr , getDictStorageNode , storageLibrary );
1042
1039
1043
- if (typeSlots == null ^ baseSlots == null ) {
1040
+ if (typeSlots == null && baseSlots != null && objectLibrary .length (baseSlots ) != 0 ||
1041
+ baseSlots == null && typeSlots != null && objectLibrary .length (typeSlots ) != 0 ) {
1044
1042
return true ;
1045
1043
}
1046
1044
@@ -1049,10 +1047,6 @@ private boolean extraivars(Object type, Object base, LookupSpecialMethodNode.Dyn
1049
1047
if (typeNewMethod != baseNewMethod ) {
1050
1048
return true ;
1051
1049
}
1052
-
1053
- if (typeSlots != null && baseSlots != null ) {
1054
- return compareSortedSlots (typeSlots , baseSlots , getObjectArrayNode );
1055
- }
1056
1050
return hasDict (base , objectLibrary ) != hasDict (type , objectLibrary );
1057
1051
}
1058
1052
0 commit comments