From: Raymond Hettinger Date: Sat, 2 May 2026 13:29:06 +0000 (-0500) Subject: gh-149221: Minor comment edit (gh-149278) X-Git-Tag: v3.15.0b1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da09ef807b162cdfbc58460b2eddf5b1a94881bb;p=thirdparty%2FPython%2Fcpython.git gh-149221: Minor comment edit (gh-149278) Minor comment edit --- diff --git a/Lib/random.py b/Lib/random.py index dc037629bab0..726a71e78289 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -838,9 +838,8 @@ class Random(_random.Random): while True: try: y += _floor(_log2(random()) / c) + 1 - # The random() function can return 0.0, which causes log2(0.0) to raise a ValueError. - # See https://github.com/python/cpython/issue/149221 except ValueError: + # Reject case where random() returned 0.0 continue if y > n: return x