Message329905
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. |
|
Date |
User |
Action |
Args |
2018-11-14 12:59:36 | vstinner | set | recipients:
+ vstinner, ncoghlan, eric.snow |
2018-11-14 12:59:36 | vstinner | set | messageid: <1542200376.77.0.788709270274.issue35239@psf.upfronthosting.co.za> |
2018-11-14 12:59:36 | vstinner | link | issue35239 messages |
2018-11-14 12:59:36 | vstinner | create | |
|