-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-134939: Add the interpreters Module #133958
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?
Conversation
7ddfb50
to
5c8545a
Compare
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 5c8545a 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133958%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
1e34abd
to
c63b6bc
Compare
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit c63b6bc 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133958%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
c63b6bc
to
ea9041c
Compare
FTR, I ran this against the buildbots and there were two failures:
Neither looks related, but I'll rerun them just to be sure. |
ea9041c
to
0a5d0e4
Compare
!buildbot aarch64 RHEL8 Refleaks |
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 0a5d0e4 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133958%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
!buildbot wasm32-wasi Non-Debug |
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 0a5d0e4 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133958%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
!buildbot wasm32-wasi Non-Debug |
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 0a5d0e4 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133958%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Doc/library/interpreters.rst
Outdated
| InterpreterError | Exception | An interpreter-related error happened. | | ||
+--------------------------+------------------+---------------------------------------------------+ | ||
| InterpreterNotFoundError | InterpreterError | The targeted interpreter no longer exists. | | ||
+--------------------------+------------------+---------------------------------------------------+ | ||
| ExecutionFailed | InterpreterError | The running code raised an uncaught exception. | | ||
+--------------------------+------------------+---------------------------------------------------+ | ||
| NotShareableError | TypeError | The object cannot be sent to another interpreter. | |
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.
It would be better to add some markup to these exceptions.
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.
Agreed. I'll be changing this table to the correct directive as soon as I can.
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.
fixed
Creating an interpreter and running code in it: | ||
|
||
:: |
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.
Creating an interpreter and running code in it: | |
:: | |
Creating an interpreter and running code in it:: |
Is the interpreter currently executing code in its | ||
:mod:`!__main__` module? |
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 the interpreter currently executing code in its | |
:mod:`!__main__` module? | |
Return True if the interpreter is currently executing code in | |
its :mod:`!__main__` module and False otherwise. |
I don't remember whether we use "Return True if X and False otherwise" for other boolean functions but I don't think I've ever seen a documentation entry with a question.
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 the interpreter currently executing code in its | |
:mod:`!__main__` module? | |
Return ``True`` if the interpreter is currently executing | |
code in its :mod:`!__main__` module, ``False`` otherwise. |
support for multiple interpreters. | ||
|
||
Also added in 3.14: :ref:`concurrent.futures.InterpreterPoolExecutor | ||
<whatsnew314-concurrent-futures-interp-pool>`. |
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.
I'd recommend adding a ".. seealso: :pep:XXX
" at the end of the section as for other PEPs
libraries on PyPI for high-level abstractions on top of interpreters. | ||
|
||
Regarding extension modules, work is in progress to update some PyPI | ||
projects, as well as tools like Cython, PyBind11, Nanobind, and Py03. |
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.
typo: Py03
(zero-three) -> PyO3
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.
projects, as well as tools like Cython, PyBind11, Nanobind, and Py03. | |
projects, as well as tools like Cython, PyBind11, Nanobind, and PyO3. |
Before we dive into examples, there are a small number of details | ||
to keep in mind about using multiple interpreters: | ||
|
||
* isolated, by default |
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.
This deserves more elaboration, or a link, given it is the first mention of isolation & in the 'key details' block.
libraries on PyPI for high-level abstractions on top of interpreters. | ||
|
||
Regarding extension modules, work is in progress to update some PyPI | ||
projects, as well as tools like Cython, PyBind11, Nanobind, and Py03. |
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.
projects, as well as tools like Cython, PyBind11, Nanobind, and Py03. | |
projects, as well as tools like Cython, PyBind11, Nanobind, and PyO3. |
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.
PEP 734 doesn't include channels, should this module be private for now?
|
||
.. function:: list_all() | ||
|
||
Return a :class:`list` of :class:`Interpreter`, |
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.
Return a :class:`list` of :class:`Interpreter`, | |
Return a :class:`list` of :class:`Interpreter` objects, |
|
||
(read-only) | ||
|
||
Where the interpreter came from. |
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.
What type is whence
?
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.
str
. My understanding is that this is mainly for introspection?
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.
Ok, it'd be good to note that here.
|
||
.. method:: prepare_main(ns=None, **kwargs) | ||
|
||
Bind "shareable" objects in the interpreter's |
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.
I think it'd be good to have a small section that included all the shareable objects. We could link to it here.
|
||
.. method:: call(callable, /, *args, **kwargs) | ||
|
||
Run the given function in the interpreter (in the current thread). |
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.
Which functions can be shared?
This is in case PEP-734 is accepted.