@@ -702,7 +702,7 @@ protected boolean isDictSubtype(VirtualFrame frame, Object obj, GetClassNode get
702
702
@ GenerateNodeFactory
703
703
public abstract static class PyDictSizeNode extends PythonUnaryBuiltinNode {
704
704
@ Specialization (limit = "3" )
705
- public Object size (PDict dict ,
705
+ public int size (PDict dict ,
706
706
@ CachedLibrary ("dict.getDictStorage()" ) HashingStorageLibrary lib ,
707
707
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
708
708
try {
@@ -979,12 +979,12 @@ protected boolean isDictSubtype(VirtualFrame frame, Object obj, GetClassNode get
979
979
@ GenerateNodeFactory
980
980
public abstract static class PyDictContainsNode extends PythonBinaryBuiltinNode {
981
981
@ Specialization (limit = "3" )
982
- public Object contains (VirtualFrame frame , PDict dict , Object key ,
982
+ public int contains (VirtualFrame frame , PDict dict , Object key ,
983
983
@ Cached ConditionProfile hasFrame ,
984
984
@ CachedLibrary ("dict.getDictStorage()" ) HashingStorageLibrary lib ,
985
985
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
986
986
try {
987
- return lib .hasKeyWithFrame (dict .getDictStorage (), key , hasFrame , frame );
987
+ return PInt . intValue ( lib .hasKeyWithFrame (dict .getDictStorage (), key , hasFrame , frame ) );
988
988
} catch (PException e ) {
989
989
transformExceptionToNativeNode .execute (e );
990
990
return -1 ;
@@ -1348,29 +1348,29 @@ public Object newSet(PNone iterable) {
1348
1348
@ GenerateNodeFactory
1349
1349
public abstract static class PySetContainsNode extends PythonBinaryBuiltinNode {
1350
1350
@ Specialization (limit = "3" )
1351
- public Object contains (VirtualFrame frame , PSet anyset , Object item ,
1351
+ public int contains (VirtualFrame frame , PSet anyset , Object item ,
1352
1352
@ Cached ConditionProfile hasFrameProfile ,
1353
1353
@ CachedLibrary ("anyset.getDictStorage()" ) HashingStorageLibrary lib ,
1354
1354
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
1355
1355
try {
1356
1356
HashingStorage storage = anyset .getDictStorage ();
1357
1357
// TODO: FIXME: this might call __hash__ twice
1358
- return lib .hasKeyWithFrame (storage , item , hasFrameProfile , frame );
1358
+ return PInt . intValue ( lib .hasKeyWithFrame (storage , item , hasFrameProfile , frame ) );
1359
1359
} catch (PException e ) {
1360
1360
transformExceptionToNativeNode .execute (e );
1361
1361
return -1 ;
1362
1362
}
1363
1363
}
1364
1364
1365
1365
@ Specialization (limit = "3" )
1366
- public Object contains (VirtualFrame frame , PFrozenSet anyset , Object item ,
1366
+ public int contains (VirtualFrame frame , PFrozenSet anyset , Object item ,
1367
1367
@ CachedLibrary ("anyset.getDictStorage()" ) HashingStorageLibrary lib ,
1368
1368
@ Cached ConditionProfile hasFrameProfile ,
1369
1369
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
1370
1370
try {
1371
1371
HashingStorage storage = anyset .getDictStorage ();
1372
1372
// TODO: FIXME: this might call __hash__ twice
1373
- return lib .hasKeyWithFrame (storage , item , hasFrameProfile , frame );
1373
+ return PInt . intValue ( lib .hasKeyWithFrame (storage , item , hasFrameProfile , frame ) );
1374
1374
} catch (PException e ) {
1375
1375
transformExceptionToNativeNode .execute (e );
1376
1376
return -1 ;
@@ -1583,21 +1583,21 @@ protected boolean isSetSubtype(VirtualFrame frame, Object obj, GetClassNode getC
1583
1583
@ GenerateNodeFactory
1584
1584
public abstract static class PyBytesSizeNode extends PythonUnaryBuiltinNode {
1585
1585
@ Specialization
1586
- public Object size (VirtualFrame frame , PBytes obj ,
1586
+ public int size (VirtualFrame frame , PBytes obj ,
1587
1587
@ Cached PyObjectSizeNode sizeNode ) {
1588
1588
return sizeNode .execute (frame , obj );
1589
1589
}
1590
1590
1591
1591
@ Specialization (guards = {"!isPBytes(obj)" , "isBytesSubtype(frame, obj, getClassNode, isSubtypeNode)" })
1592
- public Object sizeNative (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object obj ,
1592
+ public int sizeNative (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object obj ,
1593
1593
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
1594
1594
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
1595
1595
@ Cached PRaiseNativeNode raiseNativeNode ) {
1596
1596
return raiseNativeNode .raiseInt (frame , -1 , PythonBuiltinClassType .NotImplementedError , NATIVE_S_SUBTYPES_NOT_IMPLEMENTED , "bytes" );
1597
1597
}
1598
1598
1599
1599
@ Specialization (guards = {"!isPBytes(obj)" , "!isBytesSubtype(frame, obj, getClassNode, isSubtypeNode)" })
1600
- public Object size (VirtualFrame frame , Object obj ,
1600
+ public int size (VirtualFrame frame , Object obj ,
1601
1601
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
1602
1602
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
1603
1603
@ Cached StrNode strNode ,
0 commit comments