@@ -385,21 +385,31 @@ abstract static class ContainsNode extends PythonBinaryBuiltinNode {
385385 @ Child private SequenceStorageNodes .LenNode lenNode ;
386386
387387 @ Specialization
388- @ TruffleBoundary
389388 boolean contains (PBytes self , PBytes other ,
390389 @ Cached ("create()" ) BytesNodes .FindNode findNode ) {
391390 return findNode .execute (self , other , 0 , getLength (self .getSequenceStorage ())) != -1 ;
392391 }
393392
394393 @ Specialization
395- @ TruffleBoundary
396394 boolean contains (PBytes self , PByteArray other ,
397395 @ Cached ("create()" ) BytesNodes .FindNode findNode ) {
398396 return findNode .execute (self , other , 0 , getLength (self .getSequenceStorage ())) != -1 ;
399397 }
400398
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 ) {
403413 throw raise (TypeError , "a bytes-like object is required, not '%p'" , other );
404414 }
405415
0 commit comments