]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barri...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 30 Jan 2025 09:33:30 +0000 (10:33 +0100)
committerGitHub <noreply@github.com>
Thu, 30 Jan 2025 09:33:30 +0000 (09:33 +0000)
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 <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 aaee8ff0702923319a95fa3346cb003781db5f17..3df4c693a915d5ab22dfc61727bc04fbd806986e 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 94ea2f081783696ed03928a085c27bee6a46cdca..d6b0e2b4fbf1610ddfa3eceba52cddf587b5d0f5 100644 (file)
@@ -690,7 +690,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`.