summaryrefslogtreecommitdiff
path: root/tests/basics/bigint_array_overflow.py
blob: 0dd79c23d59258505cdd3c1bab287d1d30a5158f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import skip_if
skip_if.no_bigint()

try:
    from array import array
except ImportError:
    print("SKIP")
    raise SystemExit

def test_array_overflow(typecode, val):
    try:
        print(array(typecode, [val]))
    except OverflowError:
        print('OverflowError')

# big int -1
test_array_overflow('Q', -2**64 // 2**64)
test_array_overflow('L', -2**64 // 2**64)
test_array_overflow('I', -2**64 // 2**64)
test_array_overflow('H', -2**64 // 2**64)
test_array_overflow('B', -2**64 // 2**64)

# big int 2**63
test_array_overflow('q', 2**63)
test_array_overflow('l', 2**63)
test_array_overflow('i', 2**63)
test_array_overflow('h', 2**63)
test_array_overflow('b', 2**63)