[Python-Dev] New Python Initialization API
Le mer. 27 mars 2019 ? 21:26, Brett Cannon <brett at python.org> a ?crit :
> On Wed, Mar 27, 2019 at 12:39 PM Steve Dower <steve.dower at python.org> wrote:
>> I this this should be its own PEP, since as you say it is not
>> implementing the only PEP we have (or alternatively, maybe you should
>> collaborate to update PEP 432 so that it reflects what you think we
>> ought to be implementing).
> I agree that if this isn't doing what PEP 432 set out but going its own way we should probably discuss in regards to 432.
I'm sorry, I was in a hurry when I wrote the new PEP 587 and it seems
like I created some confusion. My PEP 587 is very similar to the PEP
432, because it is basically an implementation of the PEP 432 design.
I am collaborating closely with Nick Coghlan and Eric Snow on the
Python Initialization for 1 year and a half, and I just continued the
work they started.
The PEP 432 has been written in 2012 and has a "broader scope". Since
the PEP has been written, the code has been modified slowly towards
PEP 432 design, but not "exactly" the expected design, because of
concrete practical issues of the implementation.
The PEP 587 is the updated *implementation* of the PEP 432 which can
be seen as the overall *design*.
The PEP 587 is only a subset of the PEP 432: C API to initialize
Python, whereas PEP 432 goes further by introducing the concepts of
"core" and "main" initialization. The "core initialization" is a bare
minimum working Python only with builtin types, partial sys module and
no importlib. "Main initialization" is a fully working Python. This
part is out of the scope of the PEP 587, but the PEP 587 should be
flexible enough to allow to implement it later.
In fact, there is already a PyConfig._init_config flag (currently
named _PyCoreConfig._init_main) which only initializes Python up to
the "core initialization" if set to 0. This parameter is private since
it's unclear to me what should be the exact scope of "core" vs "main"
I wrote a PR to clarify the relationship between the PEP 587 and the PEP 432: