summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2016-12-27 09:07:13 (GMT)
committerRaymond Hettinger <python@rcn.com>2016-12-27 09:07:13 (GMT)
commitf45e858c60cf38a988749b8ce863cb3f171782d0 (patch)
tree38e2721806e7cd021cfa7c5f207d3b6835a94a46
parent426b140fc57f2c8f6b0af778736751165386a7ef (diff)
parentbb2839b680b565f99e463921f3c28fb3c7368096 (diff)
downloadcpython-f45e858c60cf38a988749b8ce863cb3f171782d0.zip
cpython-f45e858c60cf38a988749b8ce863cb3f171782d0.tar.gz
cpython-f45e858c60cf38a988749b8ce863cb3f171782d0.tar.bz2
merge
-rw-r--r--Lib/random.py2
-rw-r--r--Misc/NEWS3
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/random.py b/Lib/random.py
index 49b0f14..ad1c916 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -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):
diff --git a/Misc/NEWS b/Misc/NEWS
index 76a8411..84a6c4e 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -714,6 +714,9 @@ Library
- Issue 28923: Remove editor artifacts from Tix.py.
+- Issue #29055: Neaten-up empty population error on random.choice()
+ by suppressing the upstream exception.
+
- Issue #28871: Fixed a crash when deallocate deep ElementTree.
- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and