mirror of
https://github.com/python/cpython.git
synced 2025-08-08 10:58:51 +00:00
[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 bcb25d60b1
)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
c0ae83af95
commit
f463d05a09
3 changed files with 3 additions and 2 deletions
|
@ -454,7 +454,7 @@ class Barrier(mixins._LoopBoundMixin):
|
||||||
def __init__(self, parties):
|
def __init__(self, parties):
|
||||||
"""Create a barrier, initialised to 'parties' tasks."""
|
"""Create a barrier, initialised to 'parties' tasks."""
|
||||||
if parties < 1:
|
if parties < 1:
|
||||||
raise ValueError('parties must be > 0')
|
raise ValueError('parties must be >= 1')
|
||||||
|
|
||||||
self._cond = Condition() # notify all tasks when state changes
|
self._cond = Condition() # notify all tasks when state changes
|
||||||
|
|
||||||
|
|
|
@ -686,7 +686,7 @@ class Barrier:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if parties < 1:
|
if parties < 1:
|
||||||
raise ValueError("parties must be > 0")
|
raise ValueError("parties must be >= 1")
|
||||||
self._cond = Condition(Lock())
|
self._cond = Condition(Lock())
|
||||||
self._action = action
|
self._action = action
|
||||||
self._timeout = timeout
|
self._timeout = timeout
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Corrected :exc:`ValueError` message for :class:`asyncio.Barrier` and :class:`threading.Barrier`.
|
Loading…
Add table
Add a link
Reference in a new issue