From c864ccf1c6e8591583cf498ae5ecd7c7e2654d33 Mon Sep 17 00:00:00 2001 From: Debian Science Maintainers Date: Tue, 14 Feb 2023 22:28:59 +0000 Subject: [PATCH] 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 --- statsmodels/distributions/tests/test_discrete.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/statsmodels/distributions/tests/test_discrete.py b/statsmodels/distributions/tests/test_discrete.py index 21c117b..5baccee 100644 --- a/statsmodels/distributions/tests/test_discrete.py +++ b/statsmodels/distributions/tests/test_discrete.py @@ -299,7 +299,8 @@ class CheckDiscretized(): dfr = mod.get_distr(res.params) nobs_rvs = 500 rvs = dfr.rvs(size=nobs_rvs) - freq = np.bincount(rvs) + assert (rvs == rvs.astype(int)).all() + freq = np.bincount(rvs.astype(int))#the cast is to avoid an unsafe-cast error on 32 bit systems, https://bugs.debian.org/1030208 p = mod.predict(res.params, which="probs", k_max=nobs_rvs) k = len(freq) p[k - 1] += 1 - p[:k].sum() -- 2.30.2