File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules
com.oracle.graal.python.test/src/tests Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -312,3 +312,6 @@ def __int__(self):
312
312
313
313
assert int (SpecInt1 ()) == 1
314
314
assert int (SpecInt0 ()) == 0
315
+
316
+ def test_create_int_from_string ():
317
+ assert int ("5c7920a80f5261a2e5322163c79b71a25a41f414" , 16 ) == 527928385865769069253929759180846776123316630548
Original file line number Diff line number Diff line change @@ -785,7 +785,7 @@ public abstract static class IntNode extends PythonBuiltinNode {
785
785
private Object stringToInt (String num , int base ) {
786
786
String s = num .replace ("_" , "" );
787
787
if ((base >= 2 && base <= 32 ) || base == 0 ) {
788
- BigInteger bi = asciiToBigInteger (s , 10 , false );
788
+ BigInteger bi = asciiToBigInteger (s , base , false );
789
789
if (bi .compareTo (BigInteger .valueOf (Integer .MAX_VALUE )) > 0 || bi .compareTo (BigInteger .valueOf (Integer .MIN_VALUE )) < 0 ) {
790
790
return bi ;
791
791
} else {
You can’t perform that action at this time.
0 commit comments