[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-06-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sorry Steven, I'm going to mark this as rejected on the grounds that it is likely to do more harm than good. We could in fact make the range larger but it easily creates terrible effects (encouraging bad design and creating a non-interruptable,

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The only case I know that would benefit is generating random data for tests. On my computer generating 2*28 bits with getrandbits() takes 2 sec (including 1 sec for converting from bytes to int), plus 1.4 sec for converting from int to bytes. Special API

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- nosy: +tim.peters ___ Python tracker ___ ___

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: > On the other hand, this limit isn't imposed elsewhere. There are a number of places in the language with these limits. In general, we're opening them up to wider limits if there are valid use cases and if it doesn't immediately shoot you in the foot

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Campbell Barton
Campbell Barton added the comment: @rhettinger, agree that very large ints in this case aren't going to give very usable results. On the other hand, this limit isn't imposed elsewhere (you can power-of operator to create bigger numbers). Nevertheless this isn't going to give good/usable

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: Since the downstream calls to PyMem_Malloc and _PyLong_FromByteArray both accept size_t for their sizing, there isn't a problem there. That said, I think the current limitation nicely protects us from harm. If you were to run getrandbits(2**60) it would

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Campbell Barton
Campbell Barton added the comment: > This probably isn't an issue on non-Windows or 64-bit systems. In fact it is, the limitation applies to 64bit Linux too. (tested in CPython 3.5.1) -- nosy: +ideasman42 ___ Python tracker

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread SilentGhost
Changes by SilentGhost : -- components: +Extension Modules, Windows -Library (Lib) nosy: +mark.dickinson, paul.moore, rhettinger, steve.dower, tim.golden, zach.ware stage: -> patch review ___ Python tracker

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Steven Barker
New submission from Steven Barker: The C implementation of `_random.Random.getrandbits` is unnecessarily limited in the number of bits it can produce on 64-bit Windows systems. I learned about this issue in discussion of my answer to this stack overflow question: