Skip to content

Add Py_NewInterpreterFromConfig() and PyInterpreterConfig to the Public API #98733

Closed

Description

@ericsnowcurrently

In gh-98609 we added _Py_NewInterpreterFromConfig() and the _PyInterpreterConfig struct. We should consider adding them to the public API:

  • drop the leading underscore from the names
  • add entries to Docs/c-api/init.rst

This isn't an urgent need, since the API is unlikely to be in high demand. However, currently there isn't any way for users to currently configure a new interpreter (via Py_NewInterpreter()). This function will give them a supported way. Furthermore, PEP 684 ("A Per-Interpreter GIL") will likely specify that the two will be added to the public API.

The only question is if Py_NewInterpreterFromConfig() and PyInterpreterConfig are an appropriate (I hesitate to say "best") API for users. I think it is, given the simplicity, how easy it will be to add more settings in the future, and the parallel with Py_InitializeFromConfig()/PyConfig.

Activity

  1. ericsnowcurrently commented on Oct 26, 2022

    @ericsnowcurrently
    MemberAuthor

    Note that, in gh-98609, we also added PyInterpreterState.feature_flags, several flag constants (Py_RTFLAGS_*), and _PyInterpreterState_HasFeature(). Since the "features" are administrated internally, there is little need to add those to the public API. We can always add them later if there's an actual need.

  2. moved this from In Progress to Todo in Fancy CPython Boardon Oct 26, 2022
  3. nanjekyejoannah commented on Oct 9, 2023

    @nanjekyejoannah
    Contributor

    The APIs are now public, closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions