11/*
2- * Copyright (c) 2017, 2021 , Oracle and/or its affiliates.
2+ * Copyright (c) 2017, 2022 , Oracle and/or its affiliates.
33 * Copyright (c) 2013, Regents of the University of California
44 *
55 * All rights reserved.
@@ -85,6 +85,10 @@ public static GetItemNode create(ExpressionNode primary, ExpressionNode slice) {
8585 return GetItemNodeGen .create (primary , slice );
8686 }
8787
88+ protected LookupAndCallBinaryNode createLookupAndCallGetItemNode () {
89+ return LookupAndCallBinaryNode .create (SpecialMethodSlot .GetItem );
90+ }
91+
8892 @ Override
8993 public StatementNode makeWriteNode (ExpressionNode rhs ) {
9094 return SetItemNode .create (getPrimary (), getSlice (), rhs );
@@ -101,9 +105,10 @@ Object doBuiltinList(VirtualFrame frame, PList primary, Object index,
101105 @ SuppressWarnings ("unused" )
102106 @ Specialization (guards = {"!indexCheckNode.execute(index)" , "!isPSlice(index)" }, limit = "1" )
103107 public Object doListError (VirtualFrame frame , PList primary , Object index ,
108+ @ Cached ("createLookupAndCallGetItemNode()" ) LookupAndCallBinaryNode lookupAndCallGetItem ,
104109 @ SuppressWarnings ("unused" ) @ Cached PyIndexCheckNode indexCheckNode ,
105110 @ Cached PRaiseNode raiseNode ) {
106- throw raiseNode . raise ( TypeError , ErrorMessages . OBJ_INDEX_MUST_BE_INT_OR_SLICES , "list" , index );
111+ return lookupAndCallGetItem . executeObject ( frame , primary , index );
107112 }
108113
109114 @ Specialization (guards = {"indexCheckNode.execute(index) || isPSlice(index)" , "isBuiltinTuple.profileIsAnyBuiltinObject(primary)" }, limit = "1" )
0 commit comments