STINNER Victor <vstin...@redhat.com> added the comment:
Python has 3 kind of configurations: * global configuration variables like Py_VerboseFlag * core configuration: _PyCoreConfig * main interpreter configuration: _PyMainInterpreterConfig I tried to keep them consistency. Yesterday, I rewrote test_embed.InitConfigTests to really test that these 3 configurations are consistent... And I found multiple bugs :-) (I fixed them as well) sys.flags is immutable, but some configurations are only used to "initialize" Python which can then be modified. sys.path is a good example. I don't think that we can ensure that sys.path is always consistent with the main/core configuration (module_search_paths). It's possible to write "sys.path = ['/new/path']". There is no machinery at the module level to call a function when a sys module is *replaced*. I propose to try to ensure that the configuration is not modified during Python lifecycle, and so that sys.path is a *copy* of the configuration. Same rationale for sys.warnoptions (list) and sys._xoptions (dict). Attached PR 10532 implements this solution: copy lists and dicts. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35239> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com