Skip to content
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

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

Closed
2 tasks done
ericsnowcurrently opened this issue Oct 26, 2022 · 2 comments
Closed
2 tasks done
Labels
3.12 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-subinterpreters type-feature A feature request or enhancement

Comments

@ericsnowcurrently
Copy link
Member

ericsnowcurrently commented Oct 26, 2022

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.

@ericsnowcurrently ericsnowcurrently added type-feature A feature request or enhancement interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-subinterpreters 3.12 bugs and security fixes labels Oct 26, 2022
@ericsnowcurrently
Copy link
Member Author

ericsnowcurrently commented Oct 26, 2022

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.

@nanjekyejoannah
Copy link
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
Labels
3.12 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-subinterpreters type-feature A feature request or enhancement
Projects
Status: Done
Development

No branches or pull requests

2 participants