This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients dev00790, mark.dickinson, steven.daprano
Date 2020-04-25.10:17:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587809830.31.0.0423585443559.issue40388@roundup.psfhosted.org>
In-reply-to
Content
I suspect that the OP is doing something like `random.choice(range(10**40))`:

    Python 3.8.2 (default, Feb 27 2020, 19:56:42) 
    [Clang 10.0.1 (clang-1001.0.46.4)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import random
    >>> random.choice(range(10**40))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/random.py", line 288, in choice
        i = self._randbelow(len(seq))
    OverflowError: Python int too large to convert to C ssize_t

The advice in this case would be to use something like random.randrange(10**40) instead.

The actual bug here, if there is a bug, has nothing to do with random, but instead has to do with "virtual" sequences whose length exceeds 2**63 - 1. There are other issues in the tracker for this, for example issue 12159.

I suggest closing as "not a bug".
History
Date User Action Args
2020-04-25 10:17:10mark.dickinsonsetrecipients: + mark.dickinson, steven.daprano, dev00790
2020-04-25 10:17:10mark.dickinsonsetmessageid: <1587809830.31.0.0423585443559.issue40388@roundup.psfhosted.org>
2020-04-25 10:17:10mark.dickinsonlinkissue40388 messages
2020-04-25 10:17:10mark.dickinsoncreate