Commit 854d0a4b authored by Joannah Nanjekye's avatar Joannah Nanjekye Committed by Eric Snow

bpo-36487: Make C-API docs clear about what the main interpreter is. (gh-12666)

parent bf8162c8
...@@ -1141,10 +1141,18 @@ Sub-interpreter support ...@@ -1141,10 +1141,18 @@ Sub-interpreter support
While in most uses, you will only embed a single Python interpreter, there While in most uses, you will only embed a single Python interpreter, there
are cases where you need to create several independent interpreters in the are cases where you need to create several independent interpreters in the
same process and perhaps even in the same thread. Sub-interpreters allow same process and perhaps even in the same thread. Sub-interpreters allow
you to do that. You can switch between sub-interpreters using the you to do that.
:c:func:`PyThreadState_Swap` function. You can create and destroy them
using the following functions: The "main" interpreter is the first one created when the runtime initializes.
It is usually the only Python interpreter in a process. Unlike sub-interpreters,
the main interpreter has unique process-global responsibilities like signal
handling. It is also responsible for execution during runtime initialization and
is usually the active interpreter during runtime finalization. The
:c:func:`PyInterpreterState_Main` funtion returns a pointer to its state.
You can switch between sub-interpreters using the :c:func:`PyThreadState_Swap`
function. You can create and destroy them using the following functions:
.. c:function:: PyThreadState* Py_NewInterpreter() .. c:function:: PyThreadState* Py_NewInterpreter()
......
Make C-API docs clear about what the "main" interpreter is.
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment