Skip to content

Commit 6091fee

Browse files
Add a note to the docs about Interpreter methods that might fail.
1 parent 14a42a4 commit 6091fee

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Doc/library/concurrent.interpreters.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,16 @@ Interpreter objects
243243
Generally, :class:`Interpreter` shouldn't be called directly.
244244
Instead, use :func:`create` or one of the other module functions.
245245

246+
In addition to interpreters created by this module (via
247+
:func:`create`), an :class:`!Interpreter` object may wrap
248+
interpreters not created by the module. Some methods fail for such
249+
interpreters, as noted below for each such method.
250+
251+
An interpreter may be marked as currently executing code in its
252+
:mod:`!__main__` module. See :meth:`~Interpreter.is_running`.
253+
Some methods of a running :class:`!interpreter` fail, as noted
254+
below for each such method.
255+
246256
.. attribute:: id
247257

248258
(read-only)
@@ -271,21 +281,33 @@ Interpreter objects
271281
Some objects are actually shared and some are copied efficiently,
272282
but most are copied via :mod:`pickle`. See :ref:`interp-object-sharing`.
273283

284+
This method fails for unsupported modules.
285+
It also fails for running modules.
286+
274287
.. method:: exec(code, /, dedent=True)
275288

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

291+
This method fails for unsupported modules.
292+
It also fails for running modules.
293+
278294
.. method:: call(callable, /, *args, **kwargs)
279295

280296
Return the result of calling running the given function in the
281297
interpreter (in the current thread).
282298

299+
This method fails for unsupported modules.
300+
It also fails for running modules.
301+
283302
.. _interp-call-in-thread:
284303

285304
.. method:: call_in_thread(callable, /, *args, **kwargs)
286305

287306
Run the given function in the interpreter (in a new thread).
288307

308+
This method fails for unsupported modules.
309+
It also fails for running modules.
310+
289311
Exceptions
290312
^^^^^^^^^^
291313

0 commit comments

Comments
 (0)