Skip to content

Commit 95e2bd4

Browse files
committed
GR-25324: fix PyLong_AsUnsignedLong intrinsified builtin (ConvertPIntToPrimitiveNode) to raise OverflowError on int too large
1 parent 92d074a commit 95e2bd4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/CExtCommonNodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static int doPIntTo32Bit(PInt obj, int signed, @SuppressWarnings("unused") long
541541
try {
542542
if (signed != 0) {
543543
return obj.intValueExact();
544-
} else if (obj.bitCount() <= 32) {
544+
} else if (obj.bitLength() <= 32) {
545545
if (obj.isNegative()) {
546546
return raiseNegativeValue(raiseNativeNode);
547547
}
@@ -560,7 +560,7 @@ static long doPIntTo64Bit(PInt obj, int signed, @SuppressWarnings("unused") long
560560
try {
561561
if (signed != 0) {
562562
return obj.longValueExact();
563-
} else if (obj.bitCount() <= 64) {
563+
} else if (obj.bitLength() <= 64) {
564564
if (obj.isNegative()) {
565565
return raiseNegativeValue(raiseNativeNode);
566566
}

graalpython/lib-python/3/test/test_struct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ def __init__(self, format):
198198
def test_one(self, x, pack=struct.pack,
199199
unpack=struct.unpack,
200200
unhexlify=binascii.unhexlify):
201-
202201
format = self.format
202+
print(">>>> ", format, x)
203203
if self.min_value <= x <= self.max_value:
204204
expected = x
205205
if self.signed and x < 0:

0 commit comments

Comments
 (0)