bpo-38234: Fix _PyConfig_InitPathConfig() (GH-16335)

* _PyConfig_InitPathConfig() now starts by copying the global path
  configuration, and then override values set in PyConfig.
* _PyPathConfig_Calculate() implementations no longer override
  _PyPathConfig fields which are already computed. For example,
  if _PyPathConfig.prefix is not NULL, leave it unchanged.
* If Py_SetPath() has been called, _PyConfig_InitPathConfig() doesn't
  call _PyPathConfig_Calculate() anymore.
* _PyPathConfig_Calculate() no longer uses PyConfig,
  except to initialize PyCalculatePath structure.
* pathconfig_calculate(): remove useless temporary
  "_PyPathConfig new_config" variable.
* calculate_module_search_path(): remove hack to workaround memory
  allocation failure, call Py_FatalError() instead.
* Fix get_program_full_path(): handle memory allocation failure.
This commit is contained in:
Victor Stinner 2019-09-23 18:47:29 +02:00 committed by GitHub
parent 88e6447451
commit 9c42f8cda5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 318 additions and 256 deletions

View file

@ -1,2 +1,3 @@
Python ignored path passed to :c:func:`Py_SetPath`, fix Python
initialization to use the specified path.
Python ignored arguments passed to :c:func:`Py_SetPath`,
:c:func:`Py_SetPythonHome` and :c:func:`Py_SetProgramName`: fix Python
initialization to use specified arguments.