summaryrefslogtreecommitdiffstats
path: root/PC/getpathp.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-12-01 19:09:52 (GMT)
committerGitHub <noreply@github.com>2017-12-01 19:09:52 (GMT)
commitebac19dad6263141d5db0a2c923efe049dba99d2 (patch)
tree9dd0111510cfc339f2e88c24592d04bf11e0a17b /PC/getpathp.c
parent9ac3d8882712c9675c3d2f9f84af6b5729575cde (diff)
downloadcpython-ebac19dad6263141d5db0a2c923efe049dba99d2.zip
cpython-ebac19dad6263141d5db0a2c923efe049dba99d2.tar.gz
cpython-ebac19dad6263141d5db0a2c923efe049dba99d2.tar.bz2
bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)
Changes: * _PyPathConfig_Fini() cannot be called in Py_FinalizeEx(). Py_Initialize() and Py_Finalize() can be called multiple times, but it must not "forget" parameters set by Py_SetProgramName(), Py_SetPath() or Py_SetPythonHome(), whereas _PyPathConfig_Fini() clear all these parameters. * config_get_program_name() and calculate_program_full_path() now also decode paths using Py_DecodeLocale() to use the surrogateescape error handler, rather than decoding using mbstowcs() which is strict. * Change _Py_CheckPython3() prototype: () => (void) * Truncate a few lines which were too long
Diffstat (limited to 'PC/getpathp.c')
-rw-r--r--PC/getpathp.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/PC/getpathp.c b/PC/getpathp.c
index 89d37a8..f8cfd7e 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -721,12 +721,16 @@ static int
get_pth_filename(wchar_t *spbuffer, _PyPathConfig *config)
{
if (config->dll_path[0]) {
- if (!change_ext(spbuffer, config->dll_path, L"._pth") && exists(spbuffer)) {
+ if (!change_ext(spbuffer, config->dll_path, L"._pth") &&
+ exists(spbuffer))
+ {
return 1;
}
}
if (config->program_full_path[0]) {
- if (!change_ext(spbuffer, config->program_full_path, L"._pth") && exists(spbuffer)) {
+ if (!change_ext(spbuffer, config->program_full_path, L"._pth") &&
+ exists(spbuffer))
+ {
return 1;
}
}
@@ -823,8 +827,10 @@ calculate_module_search_path(const _PyMainInterpreterConfig *main_config,
#endif
/* We only use the default relative PYTHONPATH if we haven't
anything better to use! */
- int skipdefault = (main_config->module_search_path_env!=NULL || calculate->home!=NULL || \
- calculate->machine_path!=NULL || calculate->user_path!=NULL);
+ int skipdefault = (main_config->module_search_path_env != NULL ||
+ calculate->home != NULL ||
+ calculate->machine_path != NULL ||
+ calculate->user_path != NULL);
/* We need to construct a path from the following parts.
(1) the PYTHONPATH environment variable, if set;
@@ -882,7 +888,8 @@ calculate_module_search_path(const _PyMainInterpreterConfig *main_config,
start_buf = buf;
if (main_config->module_search_path_env) {
- if (wcscpy_s(buf, bufsz - (buf - start_buf), main_config->module_search_path_env)) {
+ if (wcscpy_s(buf, bufsz - (buf - start_buf),
+ main_config->module_search_path_env)) {
return INIT_ERR_BUFFER_OVERFLOW();
}
buf = wcschr(buf, L'\0');
@@ -1214,7 +1221,7 @@ Py_GetProgramFullPath(void)
static int python3_checked = 0;
static HANDLE hPython3;
int
-_Py_CheckPython3()
+_Py_CheckPython3(void)
{
wchar_t py3path[MAXPATHLEN+1];
wchar_t *s;