Skip to content

Commit 4bd46ed

Browse files
committed
Use LookupCallableSlotInMRONode in PInteropSubscriptNode
1 parent 3d84c85 commit 4bd46ed

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
import com.oracle.graal.python.builtins.objects.type.PythonBuiltinClass;
9797
import com.oracle.graal.python.builtins.objects.type.PythonClass;
9898
import com.oracle.graal.python.builtins.objects.type.PythonManagedClass;
99+
import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
99100
import com.oracle.graal.python.builtins.objects.type.TypeNodes;
100101
import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetMroNode;
101102
import com.oracle.graal.python.lib.PyLongCheckExactNode;
@@ -107,6 +108,7 @@
107108
import com.oracle.graal.python.nodes.PRaiseNode;
108109
import com.oracle.graal.python.nodes.SpecialMethodNames;
109110
import com.oracle.graal.python.nodes.attributes.LookupAttributeInMRONode;
111+
import com.oracle.graal.python.nodes.attributes.LookupCallableSlotInMRONode;
110112
import com.oracle.graal.python.nodes.attributes.LookupInheritedAttributeNode;
111113
import com.oracle.graal.python.nodes.attributes.ReadAttributeFromObjectNode;
112114
import com.oracle.graal.python.nodes.call.CallNode;
@@ -1331,17 +1333,19 @@ public static IsImmutable getUncached() {
13311333
* uncached version.
13321334
*/
13331335
@GenerateUncached
1336+
@ImportStatic(SpecialMethodSlot.class)
13341337
public abstract static class PInteropSubscriptNode extends Node {
13351338

13361339
public abstract Object execute(Object primary, Object index);
13371340

13381341
@Specialization
1339-
Object doSpecialObject(Object primary, Object index,
1340-
@Cached LookupInheritedAttributeNode.Dynamic lookupGetItemNode,
1342+
static Object doSpecialObject(Object primary, Object index,
1343+
@Cached GetClassNode getClassNode,
1344+
@Cached(parameters = "GetItem") LookupCallableSlotInMRONode lookupInMRONode,
13411345
@Cached CallBinaryMethodNode callGetItemNode,
13421346
@Cached PRaiseNode raiseNode,
13431347
@Cached ConditionProfile profile) {
1344-
Object attrGetItem = lookupGetItemNode.execute(primary, __GETITEM__);
1348+
Object attrGetItem = lookupInMRONode.execute(getClassNode.execute(primary));
13451349
if (profile.profile(attrGetItem == PNone.NO_VALUE)) {
13461350
throw raiseNode.raise(PythonBuiltinClassType.TypeError, ErrorMessages.OBJ_NOT_SUBSCRIPTABLE, primary);
13471351
}

0 commit comments

Comments
 (0)