forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythongh-130285: Fix handling of zero or empty counts in random.sampl…
…e() (pythongh-130291) (cherry picked from commit 286c517) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
- Loading branch information
1 parent
91e5e24
commit 4e0e702
Showing
3 changed files
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Misc/NEWS.d/next/Library/2025-02-21-10-32-05.gh-issue-130285.C0fkh7.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Fix corner case for :func:`random.sample` allowing the *counts* parameter to | ||
specify an empty population. So now, ``sample([], 0, counts=[])`` and | ||
``sample('abc', k=0, counts=[0, 0, 0])`` both give the same result as | ||
``sample([], 0)``. |