@@ -446,20 +446,24 @@ exception and the Python call stack.
446
446
In between the global runtime and the thread(s) lies the interpreter.
447
447
It completely encapsulates all of the non-process-global runtime state
448
448
that the interpreter's Python threads share. For example, all its
449
- threads share :data: `sys.modules `. When a Python thread is created,
450
- it belongs to an interpreter, and likewise when an OS thread is
451
- otherwise associated with Python.
449
+ threads share :data: `sys.modules `. Every Python thread belongs to a
450
+ single interpreter and runs using that shared state. The initial
451
+ interpreter is known as the "main" interpreter, and the initial thread,
452
+ where the runtime was initialized, is known as the "main" thread.
452
453
453
454
.. note ::
454
455
455
456
The interpreter here is not the same as the "bytecode interpreter",
456
457
which is what runs in each thread, executing compiled Python code.
457
458
458
- If the runtime supports using multiple interpreters then each OS thread
459
- will have at most one Python thread for each interpreter. However,
460
- only one is active in the OS thread at a time. Switching between
461
- interpreters means changing the active Python thread.
462
- The initial interpreter is known as the "main" interpreter.
459
+ Every Python thread is associated with a single OS thread, which is
460
+ where it runs. However, multiple Python threads can be associated with
461
+ the same OS thread. For example, an OS thread might run code with a
462
+ first interpreter and then with a second, each necessarily with its own
463
+ Python thread. Still, regardless of how many are *associated * with
464
+ an OS thread, only one Python thread can be actively *running * in
465
+ an OS thread at a time. Switching between interpreters means
466
+ changing the active Python thread.
463
467
464
468
Once a program is running, new Python threads can be created using the
465
469
:mod: `threading ` module (on platforms and Python implementations that
0 commit comments