changeset: 105834:0001ae913759 branch: 3.6 parent: 105831:a48cc85e5706 user: Raymond Hettinger date: Tue Dec 27 01:06:52 2016 -0800 files: Lib/random.py Misc/NEWS description: Issue #29055: Suppress upstream exception for random.choice() diff -r a48cc85e5706 -r 0001ae913759 Lib/random.py --- a/Lib/random.py Tue Dec 27 00:05:26 2016 -0500 +++ b/Lib/random.py Tue Dec 27 01:06:52 2016 -0800 @@ -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 -r a48cc85e5706 -r 0001ae913759 Misc/NEWS --- a/Misc/NEWS Tue Dec 27 00:05:26 2016 -0500 +++ b/Misc/NEWS Tue Dec 27 01:06:52 2016 -0800 @@ -42,6 +42,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