bpo-36301: Add _PyWstrList structure #12343
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Replace messy _Py_wstrlist_xxx() functions with a new clean
_PyWstrList structure and new _PyWstrList_xxx() functions.
Changes:
Add _PyCoreConfig.use_module_search_paths to decide if
_PyCoreConfig.module_search_paths should be computed or not, to
support empty search path list.
_PyWstrList_Clear() sets length to 0 and items to NULL, whereas
_Py_wstrlist_clear() only freed memory.
_PyWstrList_Append() returns an int, whereas _Py_wstrlist_append()
returned _PyInitError.
_PyWstrList uses Py_ssize_t for the length, instead of int.
Replace (int, wchar_t**) with _PyWstrList in:
Replace "int orig_argv; wchar_t **orig_argv;"
with "_PyWstrList orig_argv".
_PyCmdline and _PyPreCmdline now also copy wchar_argv.
Rename _PyArgv_Decode() to _PyArgv_AsWstrList().
PySys_SetArgvEx() now pass the fixed (argc, argv) to
_PyPathConfig_ComputeArgv0() (don't pass negative argc or NULL
argv).
https://bugs.python.org/issue36301