Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 45 additions & 4 deletions Doc/library/concurrent.interpreters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,26 @@
Initialize a new (idle) Python interpreter
and return a :class:`Interpreter` object for it.

.. function:: create_queue()
.. function:: create_queue(maxsize=0, *, unbounditems=UNBOUND)

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

*maxsize* is an integer that sets the upperbound limit on the number of
items that can be placed in the queue. Insertion will block once this
size has been reached, until queue items are consumed. If *maxsize* is
less than or equal to zero, the queue size is infinite.

*unbounditems* controls the behavior when the interpreter that put an
item into the queue is destroyed. It can be one of:

* :const:`UNBOUND_ERROR` - raise :exc:`ItemInterpreterDestroyed` when

Check warning on line 243 in Doc/library/concurrent.interpreters.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:const reference target not found: UNBOUND_ERROR [ref.const]
getting an item from a destroyed interpreter
* :const:`UNBOUND_REMOVE` - automatically remove items when their

Check warning on line 245 in Doc/library/concurrent.interpreters.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:const reference target not found: UNBOUND_REMOVE [ref.const]
original interpreter is destroyed
* :const:`UNBOUND` - return :const:`UNBOUND` in place of the original

Check warning on line 247 in Doc/library/concurrent.interpreters.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:const reference target not found: UNBOUND [ref.const]

Check warning on line 247 in Doc/library/concurrent.interpreters.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:const reference target not found: UNBOUND [ref.const]
item (default)


Interpreter objects
^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -271,7 +286,7 @@
Some objects are actually shared and some are copied efficiently,
but most are copied via :mod:`pickle`. See :ref:`interp-object-sharing`.

.. method:: exec(code, /, dedent=True)
.. method:: exec(code, /)

Run the given source code in the interpreter (in the current thread).

Expand Down Expand Up @@ -335,19 +350,45 @@
The queue's ID.


.. exception:: QueueEmptyError
.. method:: put(obj, block=True, timeout=None, *, unbounditems=None)

Add the object to the queue.

This method behaves like :meth:`queue.Queue.put`, with the additional
*unbounditems* parameter. See :func:`create_queue` for details on
the *unbounditems* parameter and its behavior.


.. method:: put_nowait(obj, *, unbounditems=None)

Add the object to the queue without blocking.

This method behaves like :meth:`queue.Queue.put_nowait`, with the
additional *unbounditems* parameter. See :func:`create_queue` for
details on the *unbounditems* parameter and its behavior.


.. exception:: QueueEmpty

This exception, a subclass of :exc:`queue.Empty`, is raised from
:meth:`!Queue.get` and :meth:`!Queue.get_nowait` when the queue
is empty.

.. exception:: QueueFullError
.. exception:: QueueFull

This exception, a subclass of :exc:`queue.Full`, is raised from
:meth:`!Queue.put` and :meth:`!Queue.put_nowait` when the queue
is full.


.. exception:: ItemInterpreterDestroyed

This exception, a subclass of :exc:`QueueError`, is raised from

Check warning on line 386 in Doc/library/concurrent.interpreters.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:exc reference target not found: QueueError [ref.exc]
:meth:`!Queue.get` and :meth:`!Queue.get_nowait` when the original
interpreter that put an item into the queue has been destroyed and
the queue was created with ``unbounditems=UNBOUND_ERROR``.


Basic usage
-----------

Expand Down
Loading