8000 gh-134939: Add a Multiple Interpreters Howto Doc by ericsnowcurrently · Pull Request #136143 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-134939: Add a Multiple Interpreters Howto Doc #136143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ericsnowcurrently
Copy link
Member
@ericsnowcurrently ericsnowcurrently commented Jun 30, 2025

@ericsnowcurrently ericsnowcurrently added the needs backport to 3.14 bugs and security fixes label Jun 30, 2025
@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news labels Jun 30, 2025
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Jun 30, 2025
@ericsnowcurrently ericsnowcurrently marked this pull request as ready for review June 30, 2025 23:00
isolated from one another since there are few restrictions on memory
access within the same process. The Python runtime makes a best
effort at isolation but extension modules may easily violate that.
Therefore, do not use multiple interpreters in security-senstive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Therefore, do not use multiple interpreters in security-senstive
Therefore, do not use multiple interpreters in security-sensitive

Therefore, do not use multiple interpreters in security-senstive
situations, where they shouldn't have access to each other's data.

That isolation facilitates a concurrency model based an independent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
That isolation facilitates a concurrency model based an independent
That isolation facilitates a concurrency model based on independent

discipline about how the isolated components in your program interact
* not all PyPI extension modules support multiple interpreters yet
* the existing tools for passing data between interpreters safely
is still relatively inefficient and limited
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is still relatively inefficient and limited
are still relatively inefficient and limited

First of all, keep in mind that using multiple interpreters is like
using multiple processes. They are isolated and independent from each
other. The main difference is that multiple interpreters live in the
same process, which makes it all more efficient and use fewer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
same process, which makes it all more efficient and use fewer
same process, which makes it all more efficient and uses fewer

Mutable State is not Shared
---------------------------

Just be be clear, the underlying data of very few mutable objects is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Just be be clear, the underlying data of very few mutable objects is
Just to be clear, the underlying data of very few mutable objects is

to run the code.

In the same way, running code in an interpreter does not reset that
interpreter.. The next time you run code in that interpreter, the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interpreter.. The next time you run code in that interpreter, the
interpreter. The next time you run code in that interpreter, the

the traceback and the process will exit with a failure code.

The behavior is very similar when code is run in an interpreter.
The traceback get printed and, rather than a failure code,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The traceback get printed and, rather than a failure code,
The traceback gets printed and, rather than a failure code,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review docs Documentation in the Doc dir needs backport to 3.14 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants
0