@@ -275,17 +275,13 @@ public Object readMember(String key,
275
275
@ ExportMessage
276
276
public boolean hasArrayElements (
277
277
@ CachedLibrary ("this" ) PythonObjectLibrary dataModelLibrary ) {
278
- return ( dataModelLibrary .isSequence (this ) || dataModelLibrary . isIterable ( this ) ) && !dataModelLibrary .isMapping (this );
278
+ return dataModelLibrary .isSequence (this ) && !dataModelLibrary .isMapping (this );
279
279
}
280
280
281
281
@ ExportMessage
282
282
public Object readArrayElement (long key ,
283
283
@ CachedLibrary ("this" ) PythonObjectLibrary dataModelLibrary ,
284
284
@ Shared ("getItemNode" ) @ Cached PInteropSubscriptNode getItemNode ,
285
- @ Exclusive @ Cached LookupInheritedAttributeNode .Dynamic lookupIterNode ,
286
- @ Exclusive @ Cached LookupInheritedAttributeNode .Dynamic lookupNextNode ,
287
- @ Exclusive @ Cached CallNode callIterNode ,
288
- @ Exclusive @ Cached CallNode callNextNode ,
289
285
@ Shared ("toForeign" ) @ Cached PTypeToForeignNode toForeign ) throws UnsupportedMessageException , InvalidArrayIndexException {
290
286
if (dataModelLibrary .isSequence (this )) {
291
287
try {
@@ -301,21 +297,6 @@ public Object readArrayElement(long key,
301
297
}
302
298
}
303
299
304
- if (dataModelLibrary .isIterable (this )) {
305
- Object attrIter = lookupIterNode .execute (this , SpecialMethodNames .__ITER__ );
306
- Object iter = callIterNode .execute (null , attrIter , this );
307
- if (iter != this ) {
308
- // there is a separate iterator for this object, should be safe to consume
309
- Object result = iterateToKey (lookupNextNode , callNextNode , iter , key );
310
- if (result != PNone .NO_VALUE ) {
311
- return result ;
312
- }
313
- // TODO(fa) refine exception handling
314
- // it's an iterable, so we assume the index is wrong
315
- throw InvalidArrayIndexException .create (key );
316
- }
317
- }
318
-
319
300
throw UnsupportedMessageException .create ();
320
301
}
321
302
@@ -353,15 +334,6 @@ public void removeArrayElement(long key,
353
334
}
354
335
}
355
336
356
- private static Object iterateToKey (LookupInheritedAttributeNode .Dynamic lookupNextNode , CallNode callNextNode , Object iter , long key ) {
357
- Object value = PNone .NO_VALUE ;
358
- for (long i = 0 ; i <= key ; i ++) {
359
- Object attrNext = lookupNextNode .execute (iter , SpecialMethodNames .__NEXT__ );
360
- value = callNextNode .execute (null , attrNext , iter );
361
- }
362
- return value ;
363
- }
364
-
365
337
@ ExportMessage
366
338
public long getArraySize (@ CachedLibrary ("this" ) PythonObjectLibrary lib ) throws UnsupportedMessageException {
367
339
// since a call to this method must be preceded by a call to 'hasArrayElements', we just
0 commit comments