@@ -967,12 +967,12 @@ private static BigInteger asciiToBigInteger(String str, int possibleBase, boolea
967967
968968 public abstract Object executeWith (Object cls , Object arg , Object keywordArg );
969969
970- protected boolean isPrimitiveInt (PythonClass cls ) {
970+ protected boolean isPrimitiveInt (LazyPythonClass cls ) {
971971 return isPrimitiveProfile .profileClass (cls , PythonBuiltinClassType .PInt );
972972 }
973973
974974 @ Specialization
975- Object parseInt (PythonClass cls , boolean arg , @ SuppressWarnings ("unused" ) PNone keywordArg ) {
975+ Object parseInt (LazyPythonClass cls , boolean arg , @ SuppressWarnings ("unused" ) PNone keywordArg ) {
976976 if (isPrimitiveInt (cls )) {
977977 return arg ? 1 : 0 ;
978978 } else {
@@ -981,15 +981,15 @@ Object parseInt(PythonClass cls, boolean arg, @SuppressWarnings("unused") PNone
981981 }
982982
983983 @ Specialization (guards = "isNoValue(keywordArg)" )
984- public Object createInt (PythonClass cls , int arg , @ SuppressWarnings ("unused" ) PNone keywordArg ) {
984+ public Object createInt (LazyPythonClass cls , int arg , @ SuppressWarnings ("unused" ) PNone keywordArg ) {
985985 if (isPrimitiveInt (cls )) {
986986 return arg ;
987987 }
988988 return factory ().createInt (cls , arg );
989989 }
990990
991991 @ Specialization (guards = "isNoValue(keywordArg)" )
992- public Object createInt (PythonClass cls , long arg , @ SuppressWarnings ("unused" ) PNone keywordArg ,
992+ public Object createInt (LazyPythonClass cls , long arg , @ SuppressWarnings ("unused" ) PNone keywordArg ,
993993 @ Cached ("createBinaryProfile()" ) ConditionProfile isIntProfile ) {
994994 if (isPrimitiveInt (cls )) {
995995 int intValue = (int ) arg ;
@@ -1003,7 +1003,7 @@ public Object createInt(PythonClass cls, long arg, @SuppressWarnings("unused") P
10031003 }
10041004
10051005 @ Specialization (guards = "isNoValue(keywordArg)" )
1006- public Object createInt (PythonClass cls , double arg , @ SuppressWarnings ("unused" ) PNone keywordArg ,
1006+ public Object createInt (LazyPythonClass cls , double arg , @ SuppressWarnings ("unused" ) PNone keywordArg ,
10071007 @ Cached ("createBinaryProfile()" ) ConditionProfile isIntProfile ) {
10081008 if (isPrimitiveInt (cls ) && isIntProfile .profile (arg >= Integer .MIN_VALUE && arg <= Integer .MAX_VALUE )) {
10091009 return (int ) arg ;
@@ -1012,15 +1012,15 @@ public Object createInt(PythonClass cls, double arg, @SuppressWarnings("unused")
10121012 }
10131013
10141014 @ Specialization
1015- public Object createInt (PythonClass cls , @ SuppressWarnings ("unused" ) PNone none , @ SuppressWarnings ("unused" ) PNone keywordArg ) {
1015+ public Object createInt (LazyPythonClass cls , @ SuppressWarnings ("unused" ) PNone none , @ SuppressWarnings ("unused" ) PNone keywordArg ) {
10161016 if (isPrimitiveInt (cls )) {
10171017 return 0 ;
10181018 }
10191019 return factory ().createInt (cls , 0 );
10201020 }
10211021
10221022 @ Specialization (guards = "isNoValue(keywordArg)" )
1023- public Object createInt (PythonClass cls , String arg , @ SuppressWarnings ("unused" ) PNone keywordArg ) {
1023+ public Object createInt (LazyPythonClass cls , String arg , @ SuppressWarnings ("unused" ) PNone keywordArg ) {
10241024 try {
10251025 Object value = stringToInt (arg , 10 );
10261026 if (isPrimitiveInt (cls )) {
@@ -1035,18 +1035,18 @@ public Object createInt(PythonClass cls, String arg, @SuppressWarnings("unused")
10351035
10361036 @ Specialization (guards = "isPrimitiveInt(cls)" , rewriteOn = NumberFormatException .class )
10371037 @ TruffleBoundary
1038- int parseInt (PythonClass cls , PIBytesLike arg , int keywordArg ) throws NumberFormatException {
1038+ int parseInt (LazyPythonClass cls , PIBytesLike arg , int keywordArg ) throws NumberFormatException {
10391039 return parseInt (cls , toString (arg ), keywordArg );
10401040 }
10411041
10421042 @ Specialization (guards = "isPrimitiveInt(cls)" , rewriteOn = NumberFormatException .class )
10431043 @ TruffleBoundary
1044- long parseLong (PythonClass cls , PIBytesLike arg , int keywordArg ) throws NumberFormatException {
1044+ long parseLong (LazyPythonClass cls , PIBytesLike arg , int keywordArg ) throws NumberFormatException {
10451045 return parseLong (cls , toString (arg ), keywordArg );
10461046 }
10471047
10481048 @ Specialization
1049- Object parseBytesError (PythonClass cls , PIBytesLike arg , int base ,
1049+ Object parseBytesError (LazyPythonClass cls , PIBytesLike arg , int base ,
10501050 @ Cached ("create()" ) BranchProfile errorProfile ) {
10511051 try {
10521052 return parsePInt (cls , toString (arg ), base );
@@ -1057,46 +1057,46 @@ Object parseBytesError(PythonClass cls, PIBytesLike arg, int base,
10571057 }
10581058
10591059 @ Specialization (guards = "isNoValue(base)" )
1060- Object parseBytesError (PythonClass cls , PIBytesLike arg , @ SuppressWarnings ("unused" ) PNone base ,
1060+ Object parseBytesError (LazyPythonClass cls , PIBytesLike arg , @ SuppressWarnings ("unused" ) PNone base ,
10611061 @ Cached ("create()" ) BranchProfile errorProfile ) {
10621062 return parseBytesError (cls , arg , 10 , errorProfile );
10631063 }
10641064
10651065 @ Specialization (guards = "isPrimitiveInt(cls)" , rewriteOn = NumberFormatException .class )
1066- int parseInt (PythonClass cls , PString arg , int keywordArg ) throws NumberFormatException {
1066+ int parseInt (LazyPythonClass cls , PString arg , int keywordArg ) throws NumberFormatException {
10671067 return parseInt (cls , arg .getValue (), keywordArg );
10681068 }
10691069
10701070 @ Specialization (guards = "isPrimitiveInt(cls)" , rewriteOn = NumberFormatException .class )
10711071 @ TruffleBoundary
1072- long parseLong (PythonClass cls , PString arg , int keywordArg ) throws NumberFormatException {
1072+ long parseLong (LazyPythonClass cls , PString arg , int keywordArg ) throws NumberFormatException {
10731073 return parseLong (cls , arg .getValue (), keywordArg );
10741074 }
10751075
10761076 @ Specialization
1077- Object parsePInt (PythonClass cls , PString arg , int keywordArg ) {
1077+ Object parsePInt (LazyPythonClass cls , PString arg , int keywordArg ) {
10781078 return parsePInt (cls , arg .getValue (), keywordArg );
10791079 }
10801080
10811081 @ Specialization (guards = "isNoValue(base)" )
1082- Object parsePInt (PythonClass cls , PString arg , PNone base ) {
1082+ Object parsePInt (LazyPythonClass cls , PString arg , PNone base ) {
10831083 return createInt (cls , arg .getValue (), base );
10841084 }
10851085
10861086 @ Specialization (guards = "isPrimitiveInt(cls)" , rewriteOn = NumberFormatException .class )
10871087 @ TruffleBoundary
1088- int parseInt (@ SuppressWarnings ("unused" ) PythonClass cls , String arg , int keywordArg ) throws NumberFormatException {
1088+ int parseInt (@ SuppressWarnings ("unused" ) LazyPythonClass cls , String arg , int keywordArg ) throws NumberFormatException {
10891089 return Integer .parseInt (arg , keywordArg );
10901090 }
10911091
10921092 @ Specialization (guards = "isPrimitiveInt(cls)" , rewriteOn = NumberFormatException .class )
10931093 @ TruffleBoundary
1094- long parseLong (@ SuppressWarnings ("unused" ) PythonClass cls , String arg , int keywordArg ) throws NumberFormatException {
1094+ long parseLong (@ SuppressWarnings ("unused" ) LazyPythonClass cls , String arg , int keywordArg ) throws NumberFormatException {
10951095 return Long .parseLong (arg , keywordArg );
10961096 }
10971097
10981098 @ Specialization (rewriteOn = NumberFormatException .class )
1099- Object parsePInt (PythonClass cls , String arg , int base ) {
1099+ Object parsePInt (LazyPythonClass cls , String arg , int base ) {
11001100 Object int2 = toInt (arg , base );
11011101 if (int2 instanceof BigInteger ) {
11021102 return factory ().createInt (cls , (BigInteger ) int2 );
@@ -1109,7 +1109,7 @@ Object parsePInt(PythonClass cls, String arg, int base) {
11091109 }
11101110
11111111 @ Specialization (replaces = "parsePInt" )
1112- Object parsePIntError (PythonClass cls , String arg , int base ) {
1112+ Object parsePIntError (LazyPythonClass cls , String arg , int base ) {
11131113 try {
11141114 return parsePInt (cls , arg , base );
11151115 } catch (NumberFormatException e ) {
@@ -1118,7 +1118,7 @@ Object parsePIntError(PythonClass cls, String arg, int base) {
11181118 }
11191119
11201120 @ Specialization
1121- public Object createInt (PythonClass cls , String arg , Object keywordArg ) {
1121+ public Object createInt (LazyPythonClass cls , String arg , Object keywordArg ) {
11221122 if (keywordArg instanceof PNone ) {
11231123 Object value = toInt (arg );
11241124 if (value == null ) {
@@ -1138,12 +1138,12 @@ public Object createInt(PythonClass cls, String arg, Object keywordArg) {
11381138
11391139 @ SuppressWarnings ("unused" )
11401140 @ Specialization (guards = {"!isString(arg)" , "!isNoValue(keywordArg)" })
1141- Object fail (PythonClass cls , Object arg , Object keywordArg ) {
1141+ Object fail (LazyPythonClass cls , Object arg , Object keywordArg ) {
11421142 throw raise (TypeError , "int() can't convert non-string with explicit base" );
11431143 }
11441144
11451145 @ Specialization (guards = {"isNoValue(keywordArg)" , "!isNoValue(obj)" , "!isHandledType(obj)" })
1146- public Object createInt (PythonClass cls , Object obj , PNone keywordArg ,
1146+ public Object createInt (LazyPythonClass cls , Object obj , PNone keywordArg ,
11471147 @ Cached ("create(__INT__)" ) LookupAndCallUnaryNode callIntNode ,
11481148 @ Cached ("create(__TRUNC__)" ) LookupAndCallUnaryNode callTruncNode ,
11491149 @ Cached ("createBinaryProfile()" ) ConditionProfile isIntProfile ) {
0 commit comments