From: Debian Science Maintainers Date: Sat, 5 Oct 2024 10:43:25 +0000 (+0100) Subject: Avoid cast exception in np.bincount X-Git-Tag: archive/raspbian/0.14.4+dfsg-1+rpi1^2~9 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ffa93d46c9257b4ca6d195219119dfd5907c701e;p=statsmodels.git Avoid cast exception in np.bincount Author: Rebecca N. Palmer Bug-Debian: https://bugs.debian.org/1030208 Forwarded: no Gbp-Pq: Name 1030208_scipy1p10.patch --- diff --git a/statsmodels/distributions/tests/test_discrete.py b/statsmodels/distributions/tests/test_discrete.py index 6091987..18bf982 100644 --- a/statsmodels/distributions/tests/test_discrete.py +++ b/statsmodels/distributions/tests/test_discrete.py @@ -1,5 +1,6 @@ import numpy as np from numpy.testing import assert_allclose, assert_equal +import sys from scipy import stats from scipy.stats import poisson, nbinom @@ -335,7 +336,8 @@ class CheckDiscretized(): # dtype('int32') according to the rule 'safe'. # To fix this, change the dtype of rvs to int32 so that it # can bepassed to np.bincount - if PYTHON_IMPL_WASM: + if PYTHON_IMPL_WASM or sys.maxsize<2**33: + assert (rvs == rvs.astype(np.int32)).all() rvs = rvs.astype(np.int32) freq = np.bincount(rvs) p = mod.predict(res.params, which="probs", k_max=nobs_rvs)