aleaxit / gmpy

General Multi-Precision arithmetic for Python 2.6+/3+ (GMP, MPIR, MPFR, MPC)
https://gmpy2.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
522 stars 86 forks source link

mpz(1)>>111111111111111111111 raises OverflowError #524

Open skirpichev opened 1 month ago

skirpichev commented 1 month ago

Probably, we should just return 0 instead (if the rhs doesn't fit in mp_bitcnt_t), something that CPython does.

Perhaps, this will address that Sage failure: https://github.com/sagemath/sage/pull/38565#issuecomment-2311204724

I'll work on a patch.