Python Glossary Русский

Python 3.14+concurrent.interpretersexception

concurrent.interpreters.InterpreterError

exceptions

Base exception of the concurrent.interpreters module (Python 3.14+), raised when an interpreter-related error happens; a subclass of Exception.

Syntax

raise concurrent.interpreters.InterpreterError

Catch it when you mean "anything went wrong with a subinterpreter": it covers both a dead interpreter (InterpreterNotFoundError) and code that blew up inside one (ExecutionFailed) — but not NotShareableError, which hangs off TypeError instead. Note that an exception raised inside the subinterpreter does not reach you unchanged: objects do not cross the interpreter boundary, so what surfaces is ExecutionFailed carrying a snapshot of the original error. The module itself is new in Python 3.14; on older versions the import already fails.

Examples

from concurrent import interpreters  # Python 3.14+
print(interpreters.InterpreterError.__name__)  # → InterpreterError
print(issubclass(interpreters.InterpreterError, Exception))  # → True
print(issubclass(interpreters.InterpreterNotFoundError, interpreters.InterpreterError))  # → True
print(issubclass(interpreters.ExecutionFailed, interpreters.InterpreterError))  # → True
try:
    raise interpreters.InterpreterError('интерпретатор недоступен')
except interpreters.InterpreterError as e:
    print(type(e).__name__, '|', e)  # → InterpreterError | интерпретатор недоступен

See also

Open in the full glossarydocs.python.orgReport an inaccuracy