Skip to content

Commit 40ad348

Browse files
committed
Update document of create_queue
1 parent e8c5e51 commit 40ad348

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Doc/library/concurrent.interpreters.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,26 @@ This module defines the following functions:
227227
Initialize a new (idle) Python interpreter
228228
and return a :class:`Interpreter` object for it.
229229

230-
.. function:: create_queue()
230+
.. function:: create_queue(maxsize=0, *, unbounditems=UNBOUND)
231231

232232
Initialize a new cross-interpreter queue and return a :class:`Queue`
233233
object for it.
234234

235+
*maxsize* is an integer that sets the upperbound limit on the number of
236+
items that can be placed in the queue. Insertion will block once this
237+
size has been reached, until queue items are consumed. If *maxsize* is
238+
less than or equal to zero, the queue size is infinite.
239+
240+
*unbounditems* controls the behavior when the interpreter that put an
241+
item into the queue is destroyed. It can be one of:
242+
243+
* :const:`UNBOUND_ERROR` - raise :exc:`ItemInterpreterDestroyed` when
244+
getting an item from a destroyed interpreter
245+
* :const:`UNBOUND_REMOVE` - automatically remove items when their
246+
original interpreter is destroyed
247+
* :const:`UNBOUND` - return :const:`UNBOUND` in place of the original
248+
item (default)
249+
235250

236251
Interpreter objects
237252
^^^^^^^^^^^^^^^^^^^
@@ -348,6 +363,14 @@ Communicating Between Interpreters
348363
is full.
349364

350365

366+
.. exception:: ItemInterpreterDestroyed
367+
368+
This exception, a subclass of :exc:`QueueError`, is raised from
369+
:meth:`!Queue.get` and :meth:`!Queue.get_nowait` when the original
370+
interpreter that put an item into the queue has been destroyed and
371+
the queue was created with ``unbounditems=UNBOUND_ERROR``.
372+
373+
351374
Basic usage
352375
-----------
353376

0 commit comments

Comments
 (0)