From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 30 Jan 2025 08:28:06 +0000 (+0100) Subject: [3.12] gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barri... X-Git-Tag: v3.12.9~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f463d05a0979aada4fadcd43ff721b1ff081d2aa;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barrier` (GH-129419) (#129469) gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barrier` (GH-129419) (cherry picked from commit bcb25d60b1baf9348e73cbd2359342cea6009c36) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Peter Bierma --- diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py index ce5d8d5bfb2e..588dca6c0e1f 100644 --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -454,7 +454,7 @@ class Barrier(mixins._LoopBoundMixin): def __init__(self, parties): """Create a barrier, initialised to 'parties' tasks.""" if parties < 1: - raise ValueError('parties must be > 0') + raise ValueError('parties must be >= 1') self._cond = Condition() # notify all tasks when state changes diff --git a/Lib/threading.py b/Lib/threading.py index 0bba85d08a01..064c74d40f39 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -686,7 +686,7 @@ class Barrier: """ if parties < 1: - raise ValueError("parties must be > 0") + raise ValueError("parties must be >= 1") self._cond = Condition(Lock()) self._action = action self._timeout = timeout diff --git a/Misc/NEWS.d/next/Library/2025-01-29-17-10-00.gh-issue-129403.314159.rst b/Misc/NEWS.d/next/Library/2025-01-29-17-10-00.gh-issue-129403.314159.rst new file mode 100644 index 000000000000..0c2bdd3136e3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-01-29-17-10-00.gh-issue-129403.314159.rst @@ -0,0 +1 @@ +Corrected :exc:`ValueError` message for :class:`asyncio.Barrier` and :class:`threading.Barrier`.