This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eric.snow, ncoghlan, vstinner
Date 2022-03-23.18:22:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648059727.0.0.864267201131.issue46964@roundup.psfhosted.org>
In-reply-to
Content
> thus far we have had no actual use cases for initializing an interpreter
>  with a different config

I don't think that sub-interpreters should have config.install_signal_handlers=1. Same for config.configure_c_stdio=1. Only the main interpreter should handle signals and the configuration of C streams (stdio, stderr, stdio).

I added _PyInterpreterState_SetConfig() to experiment changing config.bytes_warning. But this is no strong need to have an API to change it, so right now, there is still no API for that. If we allow to change it, it would be surprising to change all interpreters at once.

I don't see why config.argv (sys.argv) must be the same in all interpreters. Same for config.module_search_paths (sys.path).

For me, it makes sense to have a per-interpreter value for most PyConfig options.

> * there is no API for creating an interpreter with a different config

There is _Py_NewInterpreter(int isolated_subinterpreter) to set config.config._isolated_interpreter. But since the feature is not "official", it remains a private API.


> currently, every interpreter uses (a copy of) the original PyConfig,
> completely unchanged

Currently, it's possible to call Py_InitializeFromConfig() (or Py_Initialize()) multiple times and it changes the PyConfig of the current interpreter. See the pyinit_core_reconfigure() function. _testembed has an unit test for that: I had to implement this feature. Once, calling the function multiple times and it broke an application. See bpo-34008.
History
Date User Action Args
2022-03-23 18:22:07vstinnersetrecipients: + vstinner, ncoghlan, eric.snow
2022-03-23 18:22:07vstinnersetmessageid: <1648059727.0.0.864267201131.issue46964@roundup.psfhosted.org>
2022-03-23 18:22:06vstinnerlinkissue46964 messages
2022-03-23 18:22:06vstinnercreate