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 2018-11-14.12:59:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542200376.77.0.788709270274.issue35239@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-11-14 12:59:36vstinnersetrecipients: + vstinner, ncoghlan, eric.snow
2018-11-14 12:59:36vstinnersetmessageid: <1542200376.77.0.788709270274.issue35239@psf.upfronthosting.co.za>
2018-11-14 12:59:36vstinnerlinkissue35239 messages
2018-11-14 12:59:36vstinnercreate