@@ -953,11 +953,15 @@ public static long lookupNativeI64MemberInMRO(Object cls, CFields nativeMemberNa
953
953
attr = ReadAttributeFromObjectNode .getUncachedForceType ().execute (mroCls , CompilerDirectives .castExact (managedMemberName , TruffleString .class ));
954
954
}
955
955
if (attr != NO_VALUE ) {
956
- return indexedSlotsSize + PyNumberAsSizeNode .executeExactUncached (attr );
956
+ return PyNumberAsSizeNode .executeExactUncached (attr );
957
+ } else if (indexedSlotsSize != 0 ) {
958
+ // managed class with __slots__, but no precomputed
959
+ // basicsize/dictoffset/weaklistoffset
960
+ break ;
957
961
}
958
962
} else {
959
963
assert PGuards .isNativeClass (mroCls ) : "invalid class inheritance structure; expected native class" ;
960
- return indexedSlotsSize + CStructAccess .ReadI64Node .getUncached ().readFromObj ((PythonNativeClass ) mroCls , nativeMemberName );
964
+ return CStructAccess .ReadI64Node .getUncached ().readFromObj ((PythonNativeClass ) mroCls , nativeMemberName );
961
965
}
962
966
}
963
967
// return the value from PyBaseObject - assumed to be 0 for vectorcall_offset
@@ -1000,11 +1004,15 @@ static long doSingleContext(Object cls, CFields nativeMember, HiddenAttr managed
1000
1004
} else if (PGuards .isManagedClass (current )) {
1001
1005
Object attr = readAttrNode .execute (inliningTarget , (PythonObject ) current , managedMemberName , null );
1002
1006
if (attr != null ) {
1003
- return indexedSlotsSize + asSizeNode .executeExact (null , inliningTarget , attr );
1007
+ return asSizeNode .executeExact (null , inliningTarget , attr );
1008
+ } else if (indexedSlotsSize != 0 ) {
1009
+ // managed class with __slots__, but no precomputed
1010
+ // basicsize/dictoffset/weaklistoffset
1011
+ break ;
1004
1012
}
1005
1013
} else {
1006
1014
assert PGuards .isNativeClass (current ) : "invalid class inheritance structure; expected native class" ;
1007
- return indexedSlotsSize + getTypeMemberNode .readFromObj ((PythonNativeClass ) current , nativeMember );
1015
+ return getTypeMemberNode .readFromObj ((PythonNativeClass ) current , nativeMember );
1008
1016
}
1009
1017
current = getBaseClassNode .execute (inliningTarget , current );
1010
1018
} while (current != null );
0 commit comments