From 8b4fb4fe140e9cf57fcfa258d0d2d6fe19090fc5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 15 Sep 2015 16:15:57 +0100 Subject: py/mpz: Fix calculation of max digit storage for mpz; fix sys.maxsize. When creating constant mpz's, the length of the mpz must be exactly how many digits are used (not allocated) otherwise these numbers are not compatible with dynamically allocated numbers. Addresses issue #1448. --- tests/basics/int_mpz.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/basics/int_mpz.py b/tests/basics/int_mpz.py index 6d99accf2..8c347302a 100644 --- a/tests/basics/int_mpz.py +++ b/tests/basics/int_mpz.py @@ -77,3 +77,7 @@ x = 4611686018427387903 # small x = -4611686018427387903 # small x = 4611686018427387904 # big x = -4611686018427387904 # big + +# sys.maxsize is a constant mpz, so test it's compatible with dynamic ones +import sys +print(sys.maxsize + 1 - 1 == sys.maxsize) -- cgit v1.2.3