mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00

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
22 lines
549 B
C
22 lines
549 B
C
#ifndef Py_INTERNAL_PYGETOPT_H
|
|
#define Py_INTERNAL_PYGETOPT_H
|
|
|
|
#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
|
|
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
|
|
#endif
|
|
|
|
extern int _PyOS_opterr;
|
|
extern Py_ssize_t _PyOS_optind;
|
|
extern const wchar_t *_PyOS_optarg;
|
|
|
|
extern void _PyOS_ResetGetOpt(void);
|
|
|
|
typedef struct {
|
|
const wchar_t *name;
|
|
int has_arg;
|
|
int val;
|
|
} _PyOS_LongOption;
|
|
|
|
extern int _PyOS_GetOpt(Py_ssize_t argc, wchar_t **argv, int *longindex);
|
|
|
|
#endif /* !Py_INTERNAL_PYGETOPT_H */
|