Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup API
  • Loading branch information
vstinner committed Jul 20, 2018
commit 7b633f00d899a54fa6a982ff929bedcc8feb7cb1
2 changes: 1 addition & 1 deletion Include/internal/pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ PyAPI_DATA(_PyPathConfig) _Py_path_config;
PyAPI_FUNC(_PyInitError) _PyPathConfig_Calculate_impl(
_PyPathConfig *config,
const _PyCoreConfig *core_config);
PyAPI_FUNC(void) _PyPathConfig_Clear(_PyPathConfig *config);
PyAPI_FUNC(void) _PyPathConfig_ClearGlobal(void);

PyAPI_FUNC(_PyInitError) _Py_wstrlist_append(
int *len,
Expand Down
3 changes: 0 additions & 3 deletions Include/pylifecycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ PyAPI_FUNC(wchar_t *) Py_GetPath(void);
struct _PyPathConfig;
typedef struct _PyPathConfig _PyPathConfig;

PyAPI_FUNC(_PyInitError) _PyPathConfig_Calculate(
_PyPathConfig *path_config,
const _PyCoreConfig *core_config);
PyAPI_FUNC(_PyInitError) _PyPathConfig_SetGlobal(
const _PyPathConfig *config);
PyAPI_FUNC(PyObject*) _PyPathConfig_ComputeArgv0(int argc, wchar_t **argv);
Expand Down
2 changes: 1 addition & 1 deletion Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ pymain_free_raw(_PyMain *pymain)
configuration options set before Py_Initialize() which should
remain valid after Py_Finalize(), since
Py_Initialize()-Py_Finalize() can be called multiple times. */
_PyPathConfig_Clear(&_Py_path_config);
_PyPathConfig_ClearGlobal();

pymain_clear_config(pymain);

Expand Down
21 changes: 11 additions & 10 deletions Python/pathconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ copy_wstr(wchar_t **dst, const wchar_t *src)
}


void
static void
_PyPathConfig_Clear(_PyPathConfig *config)
{
/* _PyMem_SetDefaultAllocator() is needed to get a known memory allocator,
Expand Down Expand Up @@ -60,17 +60,11 @@ _PyPathConfig_Clear(_PyPathConfig *config)
}


/* Initialize paths for Py_GetPath(), Py_GetPrefix(), Py_GetExecPrefix()
and Py_GetProgramFullPath() */
_PyInitError
/* Calculate the path configuration: initialize path_config from core_config */
static _PyInitError
_PyPathConfig_Calculate(_PyPathConfig *path_config,
const _PyCoreConfig *core_config)
{
if (path_config->module_search_path) {
/* Already initialized */
return _Py_INIT_OK();
}

_PyInitError err;
_PyPathConfig new_config = _PyPathConfig_INIT;

Expand Down Expand Up @@ -149,7 +143,14 @@ _PyPathConfig_SetGlobal(const _PyPathConfig *config)
}


wchar_t*
void
_PyPathConfig_ClearGlobal(void)
{
_PyPathConfig_Clear(&_Py_path_config);
}


static wchar_t*
wstrlist_join(wchar_t sep, int count, wchar_t **list)
{
size_t len = 0;
Expand Down