mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #29055: Suppress upstream exception for random.choice()
This commit is contained in:
parent
246cbf23fa
commit
bb2839b680
2 changed files with 4 additions and 1 deletions
|
@ -254,7 +254,7 @@ class Random(_random.Random):
|
|||
try:
|
||||
i = self._randbelow(len(seq))
|
||||
except ValueError:
|
||||
raise IndexError('Cannot choose from an empty sequence')
|
||||
raise IndexError('Cannot choose from an empty sequence') from None
|
||||
return seq[i]
|
||||
|
||||
def shuffle(self, x, random=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue