@@ -385,21 +385,31 @@ abstract static class ContainsNode extends PythonBinaryBuiltinNode {
385
385
@ Child private SequenceStorageNodes .LenNode lenNode ;
386
386
387
387
@ Specialization
388
- @ TruffleBoundary
389
388
boolean contains (PBytes self , PBytes other ,
390
389
@ Cached ("create()" ) BytesNodes .FindNode findNode ) {
391
390
return findNode .execute (self , other , 0 , getLength (self .getSequenceStorage ())) != -1 ;
392
391
}
393
392
394
393
@ Specialization
395
- @ TruffleBoundary
396
394
boolean contains (PBytes self , PByteArray other ,
397
395
@ Cached ("create()" ) BytesNodes .FindNode findNode ) {
398
396
return findNode .execute (self , other , 0 , getLength (self .getSequenceStorage ())) != -1 ;
399
397
}
400
398
401
- @ Specialization (guards = "!isBytes(other)" )
402
- boolean contains (@ SuppressWarnings ("unused" ) PBytes self , Object other ) {
399
+ @ Specialization
400
+ boolean contains (PBytes self , int other ,
401
+ @ Cached ("create()" ) BytesNodes .FindNode findNode ) {
402
+ return findNode .execute (self , other , 0 , getLength (self .getSequenceStorage ())) != -1 ;
403
+ }
404
+
405
+ @ Specialization
406
+ boolean contains (PBytes self , long other ,
407
+ @ Cached ("create()" ) BytesNodes .FindNode findNode ) {
408
+ return findNode .execute (self , other , 0 , getLength (self .getSequenceStorage ())) != -1 ;
409
+ }
410
+
411
+ @ Fallback
412
+ boolean contains (@ SuppressWarnings ("unused" ) Object self , Object other ) {
403
413
throw raise (TypeError , "a bytes-like object is required, not '%p'" , other );
404
414
}
405
415
0 commit comments