]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barrier...
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Thu, 30 Jan 2025 08:11:12 +0000 (08:11 +0000)
committerGitHub <noreply@github.com>
Thu, 30 Jan 2025 08:11:12 +0000 (11:11 +0300)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Lib/asyncio/locks.py
Lib/threading.py
Misc/NEWS.d/next/Library/2025-01-29-17-10-00.gh-issue-129403.314159.rst [new file with mode: 0644]

index f2f8b7ec858096967dc8a578585088100665c190..fa3a94764b507ae6bb5dcac795e2895dc4ba5946 100644 (file)
@@ -485,7 +485,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
 
index d7cc3ddc44516b6e4a170663a7da11e1a1c60397..da9cdf0b09d83cc1057128e16fb0bbe658bdef10 100644 (file)
@@ -694,7 +694,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 (file)
index 0000000..0c2bdd3
--- /dev/null
@@ -0,0 +1 @@
+Corrected :exc:`ValueError` message for :class:`asyncio.Barrier` and :class:`threading.Barrier`.