File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
com.oracle.graal.python.test/src/tests
com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules 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):
312312
313313 assert int (SpecInt1 ()) == 1
314314 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 {
785785 private Object stringToInt (String num , int base ) {
786786 String s = num .replace ("_" , "" );
787787 if ((base >= 2 && base <= 32 ) || base == 0 ) {
788- BigInteger bi = asciiToBigInteger (s , 10 , false );
788+ BigInteger bi = asciiToBigInteger (s , base , false );
789789 if (bi .compareTo (BigInteger .valueOf (Integer .MAX_VALUE )) > 0 || bi .compareTo (BigInteger .valueOf (Integer .MIN_VALUE )) < 0 ) {
790790 return bi ;
791791 } else {
You can’t perform that action at this time.
0 commit comments