💾 Archived View for tris.fyi › pydoc › _xxsubinterpreters captured on 2022-04-28 at 17:36:08. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

-=-=-=-=-=-=-

Back to module index

Go to module by name

_xxsubinterpreters

This module provides primitive operations to manage Python interpreters.
The 'interpreters' module provides a more convenient interface.

Classes

ChannelClosedError

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

ChannelEmptyError

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

ChannelError

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

ChannelID

A channel ID identifies a channel and may be used as an int.
end = <attribute 'end' of '_xxsubinterpreters.ChannelID' objects>
  'send', 'recv', or 'both'
recv = <attribute 'recv' of '_xxsubinterpreters.ChannelID' objects>
  the 'recv' end of the channel
send = <attribute 'send' of '_xxsubinterpreters.ChannelID' objects>
  the 'send' end of the channel

ChannelNotEmptyError

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

ChannelNotFoundError

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

InterpreterID

A interpreter ID identifies a interpreter and may be used as an int.

RunFailedError

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

Functions

channel_close

channel_close(...)

  channel_close(cid, *, send=None, recv=None, force=False)

  Close the channel for all interpreters.

  If the channel is empty then the keyword args are ignored and both
  ends are immediately closed.  Otherwise, if 'force' is True then
  all queued items are released and both ends are immediately
  closed.

  If the channel is not empty *and* 'force' is False then following
  happens:

   * recv is True (regardless of send):
     - raise ChannelNotEmptyError
   * recv is None and send is None:
     - raise ChannelNotEmptyError
   * send is True and recv is not True:
     - fully close the 'send' end
     - close the 'recv' end to interpreters not already receiving
     - fully close it once empty

  Closing an already closed channel results in a ChannelClosedError.

  Once the channel's ID has no more ref counts in any interpreter
  the channel will be destroyed.

channel_create

channel_create(...)

  channel_create() -> cid

  Create a new cross-interpreter channel and return a unique generated ID.

channel_destroy

channel_destroy(...)

  channel_destroy(cid)

  Close and finalize the channel.  Afterward attempts to use the channel
  will behave as though it never existed.

channel_list_all

channel_list_all(...)

  channel_list_all() -> [cid]

  Return the list of all IDs for active channels.

channel_list_interpreters

channel_list_interpreters(...)

  channel_list_interpreters(cid, *, send) -> [id]

  Return the list of all interpreter IDs associated with an end of the channel.

  The 'send' argument should be a boolean indicating whether to use the send or
  receive end.

channel_recv

channel_recv(...)

  channel_recv(cid, [default]) -> obj

  Return a new object from the data at the front of the channel's queue.

  If there is nothing to receive then raise ChannelEmptyError, unless
  a default value is provided.  In that case return it.

channel_release

channel_release(...)

  channel_release(cid, *, send=None, recv=None, force=True)

  Close the channel for the current interpreter.  'send' and 'recv'
  (bool) may be used to indicate the ends to close.  By default both
  ends are closed.  Closing an already closed end is a noop.

channel_send

channel_send(...)

  channel_send(cid, obj)

  Add the object's data to the channel's queue.

create

create(...)

  create() -> ID

  Create a new interpreter and return a unique generated ID.

destroy

destroy(...)

  destroy(id)

  Destroy the identified interpreter.

  Attempting to destroy the current interpreter results in a RuntimeError.
  So does an unrecognized ID.

get_current

get_current(...)

  get_current() -> ID

  Return the ID of current interpreter.

get_main

get_main(...)

  get_main() -> ID

  Return the ID of main interpreter.

is_running

is_running(...)

  is_running(id) -> bool

  Return whether or not the identified interpreter is running.

is_shareable

is_shareable(...)

  is_shareable(obj) -> bool

  Return True if the object's data may be shared between interpreters and
  False otherwise.

list_all

list_all(...)

  list_all() -> [ID]

  Return a list containing the ID of every existing interpreter.

run_string

run_string(...)

  run_string(id, script, shared)

  Execute the provided string in the identified interpreter.

  See PyRun_SimpleStrings.