summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>2025-01-30 08:11:12 (GMT)
committerGitHub <noreply@github.com>2025-01-30 08:11:12 (GMT)
commitbcb25d60b1baf9348e73cbd2359342cea6009c36 (patch)
tree4c2bb2dd60b51d5541e7494382bce6fdc1e84a4f
parenta4722449caccc42ad644611d02fbdb5005f601eb (diff)
downloadcpython-bcb25d60b1baf9348e73cbd2359342cea6009c36.zip
cpython-bcb25d60b1baf9348e73cbd2359342cea6009c36.tar.gz
cpython-bcb25d60b1baf9348e73cbd2359342cea6009c36.tar.bz2
gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barrier` (#129419)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
-rw-r--r--Lib/asyncio/locks.py2
-rw-r--r--Lib/threading.py2
-rw-r--r--Misc/NEWS.d/next/Library/2025-01-29-17-10-00.gh-issue-129403.314159.rst1
3 files changed, 3 insertions, 2 deletions
diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py
index f2f8b7e..fa3a947 100644
--- a/Lib/asyncio/locks.py
+++ b/Lib/asyncio/locks.py
@@ -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
diff --git a/Lib/threading.py b/Lib/threading.py
index d7cc3dd..da9cdf0 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -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
index 0000000..0c2bdd3
--- /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`.