File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
com.oracle.graal.python.test/src/com/oracle/graal/python/test/datatype
com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/range Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,6 @@ public void getItem() {
9595
9696 @ Test
9797 public void getItemNegative () {
98- PRange range = PythonObjectFactory .create ().createRange (10 );
99- assertEquals (7 , range .getItemNormalized (-3 ));
10098 String source = "print(range(10)[-3])\n " ;
10199 assertPrints ("7\n " , source );
102100 }
Original file line number Diff line number Diff line change @@ -185,6 +185,11 @@ PIntegerIterator iter(PRange self) {
185185 abstract static class GetItemNode extends PythonBinaryBuiltinNode {
186186 @ Child private NormalizeIndexNode normalize = NormalizeIndexNode .forRange ();
187187
188+ @ Specialization
189+ Object doPRange (PRange primary , boolean idx ) {
190+ return primary .getItemNormalized (normalize .execute (idx , primary .len ()));
191+ }
192+
188193 @ Specialization
189194 Object doPRange (PRange primary , int idx ) {
190195 return primary .getItemNormalized (normalize .execute (idx , primary .len ()));
@@ -195,6 +200,11 @@ Object doPRange(PRange primary, long idx) {
195200 return primary .getItemNormalized (normalize .execute (idx , primary .len ()));
196201 }
197202
203+ @ Specialization
204+ Object doPRange (PRange primary , PInt idx ) {
205+ return primary .getItemNormalized (normalize .execute (idx , primary .len ()));
206+ }
207+
198208 @ Specialization
199209 Object doPRange (PRange range , PSlice slice ) {
200210 SliceInfo info = slice .computeActualIndices (range .len ());
You can’t perform that action at this time.
0 commit comments