@@ -1272,6 +1272,24 @@ Object doUnpack(int start, int stop, int step, long length) {
1272
1272
SliceInfo actualIndices = tmpSlice .computeActualIndices ((int ) length );
1273
1273
return factory ().createTuple (new Object []{actualIndices .start , actualIndices .stop , actualIndices .step , actualIndices .length });
1274
1274
}
1275
+
1276
+ @ Specialization (rewriteOn = ArithmeticException .class )
1277
+ Object doUnpackLong (long start , long stop , long step , long length ) {
1278
+ PSlice tmpSlice = factory ().createSlice (PInt .intValueExact (start ), PInt .intValueExact (stop ), PInt .intValueExact (step ));
1279
+ SliceInfo actualIndices = tmpSlice .computeActualIndices ((int ) length );
1280
+ return factory ().createTuple (new Object []{actualIndices .start , actualIndices .stop , actualIndices .step , actualIndices .length });
1281
+ }
1282
+
1283
+ @ Specialization (replaces = "doUnpackLong" )
1284
+ Object doUnpackLongOvf (long start , long stop , long step , long length ) {
1285
+ try {
1286
+ PSlice tmpSlice = factory ().createSlice (PInt .intValueExact (start ), PInt .intValueExact (stop ), PInt .intValueExact (step ));
1287
+ SliceInfo actualIndices = tmpSlice .computeActualIndices ((int ) length );
1288
+ return factory ().createTuple (new Object []{actualIndices .start , actualIndices .stop , actualIndices .step , actualIndices .length });
1289
+ } catch (ArithmeticException e ) {
1290
+ throw raiseIndexError ();
1291
+ }
1292
+ }
1275
1293
}
1276
1294
1277
1295
@ Builtin (name = "PyTruffle_Add_Subclass" , fixedNumOfArguments = 3 )
0 commit comments