File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -2181,7 +2181,12 @@ long doPointer(PInt n,
2181
2181
return n .longValueExact ();
2182
2182
} catch (OverflowException e ) {
2183
2183
overflowProfile .enter ();
2184
- throw raise (OverflowError );
2184
+ try {
2185
+ throw raise (OverflowError , ErrorMessages .PYTHON_INT_TOO_LARGE_TO_CONV_TO , "C long" );
2186
+ } catch (PException pe ) {
2187
+ ensureTransformExcNode ().execute (pe );
2188
+ return 0 ;
2189
+ }
2185
2190
}
2186
2191
}
2187
2192
@@ -2197,12 +2202,14 @@ long doGeneric(Object n) {
2197
2202
asPrimitiveNode = insert (ConvertPIntToPrimitiveNodeGen .create ());
2198
2203
}
2199
2204
try {
2200
- return asPrimitiveNode .executeLong (n , 0 , Long .BYTES );
2201
- } catch (UnexpectedResultException e ) {
2202
- throw CompilerDirectives .shouldNotReachHere ();
2205
+ try {
2206
+ return asPrimitiveNode .executeLong (n , 0 , Long .BYTES );
2207
+ } catch (UnexpectedResultException e ) {
2208
+ throw raise (OverflowError , ErrorMessages .PYTHON_INT_TOO_LARGE_TO_CONV_TO , "C long" );
2209
+ }
2203
2210
} catch (PException e ) {
2204
2211
ensureTransformExcNode ().execute (e );
2205
- return - 1 ;
2212
+ return 0 ;
2206
2213
}
2207
2214
}
2208
2215
You can’t perform that action at this time.
0 commit comments