Skip to content

Commit f1017f5

Browse files
committed
Fix: use correct node to read attribute from a type.
1 parent e4c011a commit f1017f5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,8 @@ public abstract static class PKeyInfoNode extends Node {
567567

568568
@Specialization
569569
int access(Object object, String fieldName,
570-
@Cached ReadAttributeFromObjectNode readNode,
570+
@Cached("createForceType()") ReadAttributeFromObjectNode readTypeAttrNode,
571+
@Cached ReadAttributeFromObjectNode readObjectAttrNode,
571572
@Cached IsCallableNode isCallableNode,
572573
@Cached LookupInheritedAttributeNode.Dynamic getGetNode,
573574
@Cached LookupInheritedAttributeNode.Dynamic getSetNode,
@@ -596,15 +597,17 @@ int access(Object object, String fieldName,
596597
}
597598

598599
for (PythonAbstractClass c : getMroNode.execute(klass)) {
599-
attr = readNode.execute(c, attrKeyName);
600+
// n.b. we need to use a different node because it makes a difference if the type is
601+
// native
602+
attr = readTypeAttrNode.execute(c, attrKeyName);
600603
if (attr != PNone.NO_VALUE) {
601604
owner = c;
602605
break;
603606
}
604607
}
605608

606609
if (attr == PNone.NO_VALUE) {
607-
attr = readNode.execute(owner, attrKeyName);
610+
attr = readObjectAttrNode.execute(owner, attrKeyName);
608611
}
609612

610613
if (attr != PNone.NO_VALUE) {

0 commit comments

Comments
 (0)