Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Mar 15, 2019

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).

https://bugs.python.org/issue36301

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).
Fix also compilation on Windows
@vstinner vstinner merged commit 74f6568 into python:master Mar 15, 2019
@vstinner vstinner deleted the pywstrlist branch March 15, 2019 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants