[issue46964] The global config should not be stored on each interpreter

STINNER Victor report at bugs.python.org
Wed Mar 9 04:32:38 EST 2022


STINNER Victor <vstinner at python.org> added the comment:

> Doing so unnecessarily adds extra complexity (and, when multiple interpreters are used, extra CPU usage and extra memory usage).

Right, PyConfig allocates memory per interpeter. But IMO it's an acceptable trade-off. I don't see the benefits of sharing the config between all interpreters.

Have per-interpreter config allows to create an interpreter with a different config:

* different sys.path
* isolated vs non-isolated
* dev mode
* etc.

While there is currently no easy way to use a custom config, recent changes make it easier to implement, like the function to modify a PyConfig from a Python dict: _PyInterpreterState_SetConfig().


> there is no public API for getting the config or changing it

Barry Warsaw proposed to add a function to get the config, but I didn't add it.

There are private functions for that:

* _testinternalcapi.get_config()
* _testinternalcapi.set_config()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46964>
_______________________________________


More information about the Python-bugs-list mailing list