Skip to content

Commit adcb718

Browse files
committed
Clarify use of the lock. Add message to the ValueError.
1 parent e0c44be commit adcb718

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

Doc/library/threading.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,10 +1464,9 @@ of the derived iterators.
14641464
:meth:`~iterator.__next__` using a lock.
14651465

14661466
This makes it possible to share a single iterator, including a generator
1467-
iterator, between multiple threads. Calls are handled one at a time in
1468-
arrival order determined by lock acquisition. No values are duplicated or
1469-
skipped by the wrapper itself. Each item produced by the underlying iterator
1470-
is given to exactly one caller.
1467+
iterator, between multiple threads. A lock assures that calls are handled
1468+
one at a time. No values are duplicated or skipped by the wrapper itself.
1469+
Each item from the underlying iterator is given to exactly one caller.
14711470

14721471
This wrapper does not copy or buffer values. Threads that call
14731472
:func:`next` while another thread is already advancing the iterator will

Lib/threading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ def concurrent_tee(iterable, n=2):
910910
"""
911911

912912
if n < 0:
913-
raise ValueError
913+
raise ValueError("n must be positive integer")
914914
if n == 0:
915915
return ()
916916
iterator = _concurrent_tee(iterable)

0 commit comments

Comments
 (0)