[issue40388] random.choice integer overflow v3.5.2
Steven D'Aprano
report at bugs.python.org
Sat Apr 25 05:26:50 EDT 2020
Steven D'Aprano <steve+python at pearwood.info> added the comment:
What you are describing is not what we mean by a crash (a core dump or segfault); it sounds like a regular Python exception.
Python 3.5 is obsolete and there are no more bug fixes for it except for security fixes.
You have not given us enough information to reproduce the problem. The description you give:
Function: random.choice()
Input: 40 digit integer
Expected output: no crash
Actual output: Crash
works for me:
py> import random
py> random.choice(1234567890123456789012345678901234567890) # 40 digits
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/random.py", line 253, in choice
i = self._randbelow(len(seq))
TypeError: object of type 'int' has no len()
is exactly the exception I would expect from using an int (whether 1 digit or 400 digits) as argument to random.choice.
Can you show us the actual code you run, and the actual traceback? Please copy and paste it as text, don't take a screen shot.
----------
nosy: +steven.daprano
type: crash -> behavior
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40388>
_______________________________________
More information about the Python-bugs-list
mailing list