@@ -227,9 +227,12 @@ protected PNone doPListSlice(PList self, PSlice slice) {
227
227
}
228
228
229
229
@ SuppressWarnings ("unused" )
230
- @ Specialization (guards = "!isValidIndexType(idx)" )
231
- protected Object doGeneric (PList self , Object idx ) {
232
- throw raise (PythonErrorType .TypeError , "list indices must be integers or slices, not %p" , idx );
230
+ @ Fallback
231
+ protected Object doGeneric (Object self , Object idx ) {
232
+ if (!isValidIndexType (idx )) {
233
+ throw raise (TypeError , "list indices must be integers or slices, not %p" , idx );
234
+ }
235
+ throw raise (TypeError , "descriptor '__delitem__' requires a 'list' object but received a '%p'" , idx );
233
236
}
234
237
235
238
protected boolean isValidIndexType (Object idx ) {
@@ -310,9 +313,12 @@ protected Object doPListSlice(PList self, PSlice slice) {
310
313
}
311
314
312
315
@ SuppressWarnings ("unused" )
313
- @ Specialization (guards = "!isValidIndexType(idx)" )
314
- protected Object doGeneric (PList self , Object idx ) {
315
- throw raise (PythonErrorType .TypeError , "list indices must be integers or slices, not %p" , idx );
316
+ @ Fallback
317
+ protected Object doGeneric (Object self , Object idx ) {
318
+ if (!isValidIndexType (idx )) {
319
+ throw raise (TypeError , "list indices must be integers or slices, not %p" , idx );
320
+ }
321
+ throw raise (TypeError , "descriptor '__getitem__' requires a 'list' object but received a '%p'" , idx );
316
322
}
317
323
318
324
protected boolean isValidIndexType (Object idx ) {
@@ -389,9 +395,12 @@ public Object doPList(PList list, long idx, Object value,
389
395
}
390
396
391
397
@ SuppressWarnings ("unused" )
392
- @ Specialization (guards = "!isValidIndexType(idx)" )
393
- protected Object doGeneric (PList self , Object idx , Object value ) {
394
- throw raise (PythonErrorType .TypeError , "list indices must be integers or slices, not %p" , idx );
398
+ @ Fallback
399
+ protected Object doGeneric (Object self , Object idx , Object value ) {
400
+ if (!isValidIndexType (idx )) {
401
+ throw raise (TypeError , "list indices must be integers or slices, not %p" , idx );
402
+ }
403
+ throw raise (TypeError , "descriptor '__setitem__' requires a 'list' object but received a '%p'" , idx );
395
404
}
396
405
397
406
protected boolean isValidIndexType (Object idx ) {
0 commit comments