Skip to content

bpo-32030: _PyPathConfig_Init() sets home and program_name #4673

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

Merged
merged 1 commit into from
Dec 2, 2017
Merged

bpo-32030: _PyPathConfig_Init() sets home and program_name #4673

merged 1 commit into from
Dec 2, 2017

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Dec 2, 2017

_PyPathConfig_Init() now also initialize home and program_name:

  • Rename existing _PyPathConfig_Init() to _PyPathConfig_Calculate().
    Add a new _PyPathConfig_Init() function in pathconfig.c which
    handles the _Py_path_config variable and call
    _PyPathConfig_Calculate().
  • Add home and program_name fields to _PyPathConfig.home
  • _PyPathConfig_Init() now initialize home and program_name
    from main_config
  • Py_SetProgramName(), Py_SetPythonHome() and Py_GetPythonHome() now
    calls Py_FatalError() on failure, instead of silently ignoring
    failures.
  • config_init_home() now gets directly _Py_path_config.home to only
    get the value set by Py_SetPythonHome(), or NULL if
    Py_SetPythonHome() was not called.
  • config_get_program_name() now gets directly
    _Py_path_config.program_name to only get the value set by
    Py_SetProgramName(), or NULL if Py_SetProgramName() was not called.
  • pymain_init_python() doesn't call Py_SetProgramName() anymore,
    _PyPathConfig_Init() now always sets the program name
  • Call _PyMainInterpreterConfig_Read() in
    pymain_parse_cmdline_envvars_impl() to control the memory allocator

https://bugs.python.org/issue32030

_PyPathConfig_Init() now also initialize home and program_name:

* Rename existing _PyPathConfig_Init() to _PyPathConfig_Calculate().
  Add a new _PyPathConfig_Init() function in pathconfig.c which
  handles the _Py_path_config variable and call
  _PyPathConfig_Calculate().
* Add home and program_name fields to _PyPathConfig.home
* _PyPathConfig_Init() now initialize home and program_name
  from main_config
* Py_SetProgramName(), Py_SetPythonHome() and Py_GetPythonHome() now
  calls Py_FatalError() on failure, instead of silently ignoring
  failures.
* config_init_home() now gets directly _Py_path_config.home to only
  get the value set by Py_SetPythonHome(), or NULL if
  Py_SetPythonHome() was not called.
* config_get_program_name() now gets directly
  _Py_path_config.program_name to only get the value set by
  Py_SetProgramName(), or NULL if Py_SetProgramName() was not called.
* pymain_init_python() doesn't call Py_SetProgramName() anymore,
  _PyPathConfig_Init() now always sets the program name
* Call _PyMainInterpreterConfig_Read() in
  pymain_parse_cmdline_envvars_impl() to control the memory allocator
* C API documentation: it's no more safe to call Py_GetProgramName()
  before Py_Initialize().
@vstinner vstinner merged commit af5a895 into python:master Dec 2, 2017
@vstinner vstinner deleted the path_config5 branch December 2, 2017 09:11
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Dec 2, 2017
serhiy-storchaka added a commit that referenced this pull request Dec 2, 2017
… (#4681)

* Revert "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)"

This reverts commit af5a895.

* Revert "bpo-32030: Fix config_get_program_name() on macOS (#4669)"

This reverts commit e23c06e.

* Revert "bpo-32030: Add Python/pathconfig.c (#4668)"

This reverts commit 0ea395a.

* Revert "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)"

This reverts commit ebac19d.

* Revert "bpo-32030: Fix Py_GetPath(): init program_name (#4665)"

This reverts commit 9ac3d88.
vstinner added a commit that referenced this pull request Dec 4, 2017
…po-32030. (#4681)" (#4694)

* Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)"

This reverts commit 13badcb.

Re-apply commits:

* "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)"
  commit af5a895.
* "bpo-32030: Fix config_get_program_name() on macOS (#4669)"
  commit e23c06e.
* "bpo-32030: Add Python/pathconfig.c (#4668)"
  commit 0ea395a.
* "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)"
  commit ebac19d.
* "bpo-32030: Fix Py_GetPath(): init program_name (#4665)"
  commit 9ac3d88.

* Fix compilation error on macOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants