Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbbdfb5

Browse files
committed
Merge 3.4 (asyncio doc)
2 parents 7cbb78c + f91d845 commit cbbdfb5

2 files changed

Lines changed: 36 additions & 33 deletions

File tree

Doc/library/asyncio-sync.rst

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ Queue
310310
be interrupted between calling :meth:`qsize` and doing an operation on the
311311
Queue.
312312

313+
.. versionchanged:: 3.4.3
314+
New :meth:`join` and :meth:`task_done` methods.
315+
313316
.. method:: empty()
314317

315318
Return ``True`` if the queue is empty, ``False`` otherwise.
@@ -341,6 +344,20 @@ Queue
341344
Return an item if one is immediately available, else raise
342345
:exc:`QueueEmpty`.
343346

347+
.. coroutinemethod:: join()
348+
349+
Block until all items in the queue have been gotten and processed.
350+
351+
The count of unfinished tasks goes up whenever an item is added to the
352+
queue. The count goes down whenever a consumer thread calls
353+
:meth:`task_done` to indicate that the item was retrieved and all work on
354+
it is complete. When the count of unfinished tasks drops to zero,
355+
:meth:`join` unblocks.
356+
357+
This method is a :ref:`coroutine <coroutine>`.
358+
359+
.. versionadded:: 3.4.3
360+
344361
.. coroutinemethod:: put(item)
345362

346363
Put an item into the queue. If the queue is full, wait until a free slot
@@ -362,6 +379,23 @@ Queue
362379

363380
Number of items in the queue.
364381

382+
.. method:: task_done()
383+
384+
Indicate that a formerly enqueued task is complete.
385+
386+
Used by queue consumers. For each :meth:`~Queue.get` used to fetch a task, a
387+
subsequent call to :meth:`task_done` tells the queue that the processing
388+
on the task is complete.
389+
390+
If a :meth:`join` is currently blocking, it will resume when all items
391+
have been processed (meaning that a :meth:`task_done` call was received
392+
for every item that had been :meth:`~Queue.put` into the queue).
393+
394+
Raises :exc:`ValueError` if called more times than there were items
395+
placed in the queue.
396+
397+
.. versionadded:: 3.4.3
398+
365399
.. attribute:: maxsize
366400

367401
Number of items allowed in the queue.
@@ -392,35 +426,9 @@ JoinableQueue
392426

393427
.. class:: JoinableQueue
394428

395-
A subclass of :class:`Queue` with :meth:`task_done` and :meth:`join`
396-
methods.
397-
398-
.. coroutinemethod:: join()
399-
400-
Block until all items in the queue have been gotten and processed.
401-
402-
The count of unfinished tasks goes up whenever an item is added to the
403-
queue. The count goes down whenever a consumer thread calls
404-
:meth:`task_done` to indicate that the item was retrieved and all work on
405-
it is complete. When the count of unfinished tasks drops to zero,
406-
:meth:`join` unblocks.
407-
408-
This method is a :ref:`coroutine <coroutine>`.
409-
410-
.. method:: task_done()
411-
412-
Indicate that a formerly enqueued task is complete.
413-
414-
Used by queue consumers. For each :meth:`~Queue.get` used to fetch a task, a
415-
subsequent call to :meth:`task_done` tells the queue that the processing
416-
on the task is complete.
417-
418-
If a :meth:`join` is currently blocking, it will resume when all items
419-
have been processed (meaning that a :meth:`task_done` call was received
420-
for every item that had been :meth:`~Queue.put` into the queue).
429+
Deprecated alias for :class:`Queue`.
421430

422-
Raises :exc:`ValueError` if called more times than there were items
423-
placed in the queue.
431+
.. deprecated:: 3.4.3
424432

425433

426434
Exceptions

Doc/tools/extensions/pyspecific.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,12 @@ def run(self):
148148
class PyCoroutineMixin(object):
149149
def handle_signature(self, sig, signode):
150150
ret = super(PyCoroutineMixin, self).handle_signature(sig, signode)
151-
# signode.insert(0, addnodes.desc_addname('coroutine ', 'coroutine '))
152151
signode.insert(0, addnodes.desc_annotation('coroutine ', 'coroutine '))
153152
return ret
154153

155-
def needs_arglist(self):
156-
return False
157-
158154

159155
class PyCoroutineFunction(PyCoroutineMixin, PyModulelevel):
160156
def run(self):
161-
# a decorator function is a function after all
162157
self.name = 'py:function'
163158
return PyModulelevel.run(self)
164159

0 commit comments

Comments
 (0)