]> granicus.if.org Git - python/commit
bpo-36301: Add _PyWstrList structure (GH-12343)
authorVictor Stinner <vstinner@redhat.com>
Fri, 15 Mar 2019 14:08:05 +0000 (15:08 +0100)
committerGitHub <noreply@github.com>
Fri, 15 Mar 2019 14:08:05 +0000 (15:08 +0100)
commit74f6568bbd3e70806ea3219e8bacb386ad802ccf
tree98516f3e71020f12109372492180a835307e129f
parent86082c22d23285995a32aabb491527c9f5629556
bpo-36301: Add _PyWstrList structure (GH-12343)

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:

  * _PyPreConfig
  * _PyCoreConfig
  * _PyPreCmdline
  * _PyCmdline

* 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).
* _PyOS_GetOpt() uses Py_ssize_t
Include/cpython/coreconfig.h
Include/internal/pycore_coreconfig.h
Include/internal/pycore_getopt.h
Include/internal/pycore_pathconfig.h
Modules/main.c
Programs/_testembed.c
Python/coreconfig.c
Python/getopt.c
Python/pathconfig.c
Python/preconfig.c
Python/sysmodule.c