]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] 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 08:28:06 +0000 (09:28 +0100)
committerGitHub <noreply@github.com>
Thu, 30 Jan 2025 08:28:06 +0000 (08:28 +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 ce5d8d5bfb2e81eeaff5229411962f1d8629e011..588dca6c0e1f22a47c2f7570287a0223b316bf15 100644 (file)
@@ -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
 
index 0bba85d08a015124d86de4e15ba054605daf7342..064c74d40f39d06e3f983c104e2948ecd13ceb19 100644 (file)
@@ -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 (file)
index 0000000..0c2bdd3
--- /dev/null
@@ -0,0 +1 @@
+Corrected :exc:`ValueError` message for :class:`asyncio.Barrier` and :class:`threading.Barrier`.