You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
random.randint failure with large int64s on windows #6812
clearly using platform ints internally. But I think this should upcast in the case of overflow?
In [21]: np.random.randint(np.iinfo(np.int32).min,np.iinfo(np.int32).max,10)
Out[21]:
array([ -397752718, -1983241147, -920985850, -2131569981, -769723972,
-499680303, 1808795318, -636996393, -1437760815, 1771191619])
In [22]: np.random.randint(np.iinfo(np.int64).min,np.iinfo(np.int64).max,10)
---------------------------------------------------------------------------
OverflowError Traceback (most recent call last)
<ipython-input-22-3cceca91fd37> in <module>()
----> 1 np.random.randint(np.iinfo(np.int64).min,np.iinfo(np.int64).max,10)
mtrand.pyx in mtrand.RandomState.randint (numpy\random\mtrand\mtrand.c:10694)()
OverflowError: Python int too large to convert to C long
In [23]: np.__version__
Out[23]: '1.10.1'
I might also add that this is not an issue for Windows in particular. It has to do with which distro of Python you are using. My guess is that you are using a 32-bit version, as I was able to replicate this issue on a 32-bit Ubuntu VM.
Activity
charris commentedon Dec 11, 2015
Hmm, at least I don't think this is a regression ;) I suppose it comes down to using
long longvslongsomewhere.charris commentedon Dec 11, 2015
I'm going to flag this as a wanted enhancement.
jreback commentedon Dec 11, 2015
thanks @charris !
gfyoung commentedon Dec 12, 2015
@charris : Indeed,
long longvs.longis the case. PR is going up right now for that.gfyoung commentedon Dec 18, 2015
I might also add that this is not an issue for Windows in particular. It has to do with which distro of Python you are using. My guess is that you are using a 32-bit version, as I was able to replicate this issue on a 32-bit Ubuntu VM.
TST,BUG: Fix use of randint in test_mem_overlap.py.