-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Py_Initialize(): computing path configuration must not have side effect (PEP 432) #78351
Comments
Attached PR reworks _PyCoreConfig_Read() to leave _Py_path_config unchanged: *reading* the core configuration must not *modify* the path configuration. The PR adds _PyCoreConfig.dll_path field. The change is related to the PEP-432. |
See also bpo-34008: "Do we support calling Py_Main() after Py_Initialize()?". |
PR 8353 is the last piece of my long work on Py_Main() to separate code *reading* configuration and code *applying* a new configuration. My work on the new _PyPathConfig structure, and the PR should finish that work. Extract of the commit message: "A new _PyCoreConfig_SetPathConfig() function now recreates the path configuration from the core configuration. This function is now called very late in _Py_InitializeCore(), just before calling initimport()." |
Reminder for myself: I have to write unit tests :-) |
I added many fields to _PyCoreConfig which duplicate global configuration varibles: _PyConfigCore.isolated duplicates Py_IsolatedFlag. I started to modify Python to read the core configuration rather than global configuration flags. The problem is that sometimes, global configuration flags are updated, but not their duplicated core configuration fields. Example from Modules/main.c: static void
pymain_repl(_PyMain *pymain, _PyCoreConfig *config, PyCompilerFlags *cf)
{
/* Check this environment variable at the end, to give programs the
opportunity to set it from Python. */
if (!Py_InspectFlag && config_get_env_var(config, "PYTHONINSPECT")) {
Py_InspectFlag = 1;
}
...
} Only Py_InspectFlag is not, not core_config.inspect. |
TODO list, open questions:
|
I created bpo-34228 "Allow PYTHONTRACEMALLOC=0 and -X tracemalloc=0 to disable explicitly tracemalloc" that I need to write unit tests on Python initiallization. |
New changeset 6c785c0 by Victor Stinner in branch 'master': |
"""
=> DONE! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: