[Python-ideas] Exposing CPython's subinterpreter C-API in the stdlib.

Guido van Rossum guido at python.org
Wed May 24 23:30:42 EDT 2017


Hm... Curiously, I've heard a few people at PyCon mention they thought
subinterpreters were broken and not useful (and they share the GIL anyways)
and should be taken out. So we should at least have clarity on which
direction we want to take...

On Wed, May 24, 2017 at 6:01 PM, Eric Snow <ericsnowcurrently at gmail.com>
wrote:

> Although I haven't been able to achieve the pace that I originally
> wanted, I have been able to work on my multi-core Python idea
> little-by-little.  Most notably, some of the blockers have been
> resolved at the recent PyCon sprints and I'm ready to move onto the
> next step: exposing multiple interpreters via a stdlib module.
>
> Initially I just want to expose basic support via 3 successive
> changes.  Below I've listed the corresponding (chained) PRs, along
> with what they add.  Note that the 2 proposed modules take some cues
> from the threading module, but don't try to be any sort of
> replacement.  Threading and subinterpreters are two different features
> that are used together rather than as alternatives to one another.
>
> At the very least I'd like to move forward with the _interpreters
> module sooner rather than later.  Doing so will facilitate more
> extensive testing of subinterpreters, in preparation for further use
> of them in the multi-core Python project.  We can iterate from there,
> but I'd at least like to get the basic functionality landed early.
> Any objections to (or feedback about) the low-level _interpreters
> module as described?  Likewise for the high-level interpreters module?
>
> Discussion on any expanded functionality for the modules or on the
> broader topic of the multi-core project are both welcome, but please
> start other threads for those topics.
>
> -eric
>
>
> basic low-level API: https://github.com/python/cpython/pull/1748
>
>   _interpreters.create() -> id
>   _interpreters.destroy(id)
>   _interpreters.run_string(id, code)
>   _interpreters.run_string_unrestricted(id, code, ns=None) -> ns
>
> extra low-level API: https://github.com/python/cpython/pull/1802
>
>   _interpreters.enumerate() -> [id, ...]
>   _interpreters.get_current() -> id
>   _interpreters.get_main() -> id
>   _interpreters.is_running(id) -> bool
>
> basic high-level API: https://github.com/python/cpython/pull/1803
>
>   interpreters.enumerate() -> [Interpreter, ...]
>   interpreters.get_current() -> Interpreter
>   interpreters.get_main() -> Interpreter
>   interpreters.create() -> Interpreter
>   interpreters.Interpreter(id)
>   interpreters.Interpreter.is_running()
>   interpreters.Interpreter.destroy()
>   interpreters.Interpreter.run(code)
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170524/5c0e4505/attachment.html>


More information about the Python-ideas mailing list