mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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
This commit is contained in:
parent
86082c22d2
commit
74f6568bbd
11 changed files with 303 additions and 345 deletions
|
@ -37,9 +37,9 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
int _PyOS_opterr = 1; /* generate error messages */
|
||||
int _PyOS_optind = 1; /* index into argv array */
|
||||
wchar_t *_PyOS_optarg = NULL; /* optional argument */
|
||||
int _PyOS_opterr = 1; /* generate error messages */
|
||||
Py_ssize_t _PyOS_optind = 1; /* index into argv array */
|
||||
const wchar_t *_PyOS_optarg = NULL; /* optional argument */
|
||||
|
||||
static wchar_t *opt_ptr = L"";
|
||||
|
||||
|
@ -61,7 +61,7 @@ void _PyOS_ResetGetOpt(void)
|
|||
opt_ptr = L"";
|
||||
}
|
||||
|
||||
int _PyOS_GetOpt(int argc, wchar_t **argv, int *longindex)
|
||||
int _PyOS_GetOpt(Py_ssize_t argc, wchar_t **argv, int *longindex)
|
||||
{
|
||||
wchar_t *ptr;
|
||||
wchar_t option;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue