]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-32030: Rewrite calculate_path() (#4521)
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 23 Nov 2017 16:03:20 +0000 (17:03 +0100)
committerGitHub <noreply@github.com>
Thu, 23 Nov 2017 16:03:20 +0000 (17:03 +0100)
commit0327bde9da203bb256b58218d012ca76ad0db4e4
treea54c0feb235156b9c01db641ebbf18f0a695ad56
parentbdb8315c21825487b54852ff0511fb4881ea2181
bpo-32030: Rewrite calculate_path() (#4521)

* calculate_path() rewritten in Modules/getpath.c and PC/getpathp.c
* Move global variables into a new PyPathConfig structure.
* calculate_path():

  * Split the huge calculate_path() function into subfunctions.
  * Add PyCalculatePath structure to pass data between subfunctions.
  * Document PyCalculatePath fields.
  * Move cleanup code into a new calculate_free() subfunction
  * calculate_init() now handles Py_DecodeLocale() failures properly
  * calculate_path() is now atomic: only replace PyPathConfig
    (path_config) at once on success.

* _Py_GetPythonHomeWithConfig() now returns an error on failure
* Add _Py_INIT_NO_MEMORY() helper: report a memory allocation failure
* Coding style fixes (PEP 7)
Include/pylifecycle.h
Modules/getpath.c
Modules/main.c
PC/getpathp.c
Python/pylifecycle.c