PEP 741: Add Multi-phase section (#3706)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
Victor Stinner 2024-03-09 08:58:39 +01:00 committed by GitHub
parent 7e7296bfdc
commit c4a5976ff3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 30 additions and 0 deletions

View File

@ -1053,6 +1053,36 @@ implemented in Python 3.8.
Disallow setting the ``"configure_locale"`` option has similar issues. Disallow setting the ``"configure_locale"`` option has similar issues.
Multi-phase initialization (similar to PEP 432)
-----------------------------------------------
`Eric Snow expressed concerns <https://discuss.python.org/t/pep-741-python-configuration-c-api-second-version/45403/27>`_
that this proposal might reinforce with embedders the idea that
initialization is a single monolithic step. He argued that initialization
involves 5 distinct phases and even suggested that the API should
reflect this explicitly. Eric proposed that, at the very least, the
implementation of initialization should reflect the phases, in part
for improved code health. Overall, his explanation has some
similarities with :pep:`432` and :pep:`587`.
Another of Eric's key points relevant to this PEP was that, ideally,
the config passed to ``Py_InitializeFromConfig()`` should be complete
before that function is called, whereas currently initialization
actually modifies the config.
While Eric wasn't necessarily suggesting an alternative to PEP 741,
any proposal to add a granular initialization API around phases is
effectively the opposite of what this PEP is trying to accomplish.
Such API is more complicated, it requires adding new public structures
and new public functions. It makes the Python initialization more
complicated, rather than this PEP tries to unifiy existing APIs and make
them simpler (the opposite). Having multiple structures for similar
purpose can lead to duplicate members, similar issue than duplicated
members between existing ``PyPreConfig`` and ``PyConfig`` structures.
.. XXX Are the concerns still valid about the config currently not
being complete before ``Py_InitializeFromConfig()`` is called?
Discussions Discussions
=========== ===========