Skip to content

Commit 66a02cd

Browse files
committed
[GR-36883] Fix multiple bases with instance lay-out conflict.
1 parent a039d8e commit 66a02cd

File tree

2 files changed

+5
-7
lines changed
  • graalpython
    • com.oracle.graal.python.test/src/tests
    • com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type

2 files changed

+5
-7
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,18 +1138,16 @@ protected Object solidBase(Object type, GetBaseClassNode getBaseClassNode, Pytho
11381138
typeIsNotBase.enter();
11391139

11401140
Object typeSlots = getSlotsFromType(type, readAttr);
1141-
Object baseSlots = getSlotsFromType(base, readAttr);
1142-
if (extraivars(type, base, typeSlots, baseSlots, getArrayNode)) {
1141+
if (extraivars(type, base, typeSlots, getArrayNode)) {
11431142
return type;
11441143
} else {
11451144
return base;
11461145
}
11471146
}
11481147

11491148
@TruffleBoundary
1150-
private static boolean extraivars(Object type, Object base, Object typeSlots, Object baseSlots, GetInternalObjectArrayNode getArrayNode) {
1151-
if (typeSlots == null && baseSlots != null && length(baseSlots, getArrayNode) != 0 ||
1152-
baseSlots == null && typeSlots != null && length(typeSlots, getArrayNode) != 0) {
1149+
private static boolean extraivars(Object type, Object base, Object typeSlots, GetInternalObjectArrayNode getArrayNode) {
1150+
if (typeSlots != null && length(typeSlots, getArrayNode) != 0) {
11531151
return true;
11541152
}
11551153
Object typeNewMethod = LookupAttributeInMRONode.lookup(type, __NEW__, GetMroStorageNode.getUncached(), ReadAttributeFromObjectNode.getUncached(), true);
@@ -1159,7 +1157,7 @@ private static boolean extraivars(Object type, Object base, Object typeSlots, Ob
11591157

11601158
@TruffleBoundary
11611159
private static int length(Object slotsObject, GetInternalObjectArrayNode getArrayNode) {
1162-
assert PGuards.isString(slotsObject) || PGuards.isPSequence(slotsObject): "slotsObject must be either a String or a PSequence";
1160+
assert PGuards.isString(slotsObject) || PGuards.isPSequence(slotsObject) : "slotsObject must be either a String or a PSequence";
11631161

11641162
if (PGuards.isString(slotsObject)) {
11651163
return (slotsObject.equals(__DICT__) || slotsObject.equals(__WEAKREF__)) ? 0 : 1;

0 commit comments

Comments
 (0)