Skip to content

Commit 5cb638b

Browse files
committed
Fix check for builtin getattribute to include getattr
1 parent 7973210 commit 5cb638b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyObjectGetMethod.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,18 @@ public abstract class PyObjectGetMethod extends Node {
8282
public abstract Object execute(Frame frame, Object receiver, String name);
8383

8484
protected static boolean isObjectGetAttribute(Object lazyClass) {
85-
Object slotValue = null;
85+
Object getattributeSlot = null;
86+
Object getattrSlot = null;
8687
if (lazyClass instanceof PythonBuiltinClassType) {
87-
slotValue = SpecialMethodSlot.GetAttribute.getValue((PythonBuiltinClassType) lazyClass);
88+
PythonBuiltinClassType type = (PythonBuiltinClassType) lazyClass;
89+
getattributeSlot = SpecialMethodSlot.GetAttribute.getValue(type);
90+
getattrSlot = SpecialMethodSlot.GetAttr.getValue(type);
8891
} else if (lazyClass instanceof PythonManagedClass) {
89-
slotValue = SpecialMethodSlot.GetAttribute.getValue((PythonManagedClass) lazyClass);
92+
PythonManagedClass type = (PythonManagedClass) lazyClass;
93+
getattributeSlot = SpecialMethodSlot.GetAttribute.getValue(type);
94+
getattrSlot = SpecialMethodSlot.GetAttr.getValue(type);
9095
}
91-
return slotValue == BuiltinMethodDescriptors.OBJ_GET_ATTRIBUTE;
96+
return getattributeSlot == BuiltinMethodDescriptors.OBJ_GET_ATTRIBUTE && getattrSlot == PNone.NO_VALUE;
9297
}
9398

9499
@Specialization(guards = "!isObjectGetAttribute(lazyClass)", limit = "1")

0 commit comments

Comments
 (0)