-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
base: main
Are you sure you want to change the base?
gh-134939: Add a Multiple Interpreters Howto Doc #136143
Conversation
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The traceback get printed and, rather than a failure code, | |
The traceback gets printed and, rather than a failure code, |
📚 Documentation preview 📚: https://cpython-previews--136143.org.readthedocs.build/