[Python-checkins] cpython (merge 3.6 -> default): merge

raymond.hettinger python-checkins at python.org
Tue Dec 27 04:07:20 EST 2016


https://hg.python.org/cpython/rev/a1a5260be005
changeset:   105835:a1a5260be005
parent:      105833:c75ef013bca3
parent:      105834:0001ae913759
user:        Raymond Hettinger <python at rcn.com>
date:        Tue Dec 27 01:07:13 2016 -0800
summary:
  merge

files:
  Lib/random.py |  2 +-
  Misc/NEWS     |  3 +++
  2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/random.py b/Lib/random.py
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -254,7 +254,7 @@
         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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -714,6 +714,9 @@
 
 - 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

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list