summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-20 09:02:00 (GMT)
committerGitHub <noreply@github.com>2019-05-20 09:02:00 (GMT)
commit6d1c46746e17367caf8a24623cb5c9a9c4e3e036 (patch)
tree17ea108a38c01e32ec2d3a25df03bd47968af7ff /Include/internal
parent6d965b39b7a486dd9e96a60b19ee92382d668299 (diff)
downloadcpython-6d1c46746e17367caf8a24623cb5c9a9c4e3e036.zip
cpython-6d1c46746e17367caf8a24623cb5c9a9c4e3e036.tar.gz
cpython-6d1c46746e17367caf8a24623cb5c9a9c4e3e036.tar.bz2
bpo-36763: Fix Python preinitialization (GH-13432)
* Add _PyPreConfig.parse_argv * Add _PyCoreConfig._config_init field and _PyCoreConfigInitEnum enum type * Initialization functions: reject preconfig=NULL and config=NULL * Add config parameter to _PyCoreConfig_DecodeLocaleErr(): pass config->argv to _Py_PreInitializeFromPyArgv(), to parse config command line arguments in preinitialization. * Add config parameter to _PyCoreConfig_SetString(). It now preinitializes Python. * _PyCoreConfig_SetPyArgv() now also preinitializes Python for wide argv * Fix _Py_PreInitializeFromCoreConfig(): don't pass args to _Py_PreInitializeFromPyArgv() if config.parse_argv=0. * Use "char * const *" and "wchar_t * const *" types for 'argv' parameters and _PyArgv.argv. * Add unit test on preinitialization from argv. * _PyPreConfig.allocator type becomes int * Add _PyPreConfig_InitFromPreConfig() and _PyPreConfig_InitFromCoreConfig() helper functions
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_coreconfig.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/Include/internal/pycore_coreconfig.h b/Include/internal/pycore_coreconfig.h
index edde7b1..324e0b8 100644
--- a/Include/internal/pycore_coreconfig.h
+++ b/Include/internal/pycore_coreconfig.h
@@ -63,8 +63,8 @@ PyAPI_FUNC(int) _PyWstrList_Extend(_PyWstrList *list,
typedef struct {
Py_ssize_t argc;
int use_bytes_argv;
- char **bytes_argv;
- wchar_t **wchar_argv;
+ char * const *bytes_argv;
+ wchar_t * const *wchar_argv;
} _PyArgv;
PyAPI_FUNC(_PyInitError) _PyArgv_AsWstrList(const _PyArgv *args,
@@ -121,6 +121,12 @@ PyAPI_FUNC(_PyInitError) _PyPreCmdline_Read(_PyPreCmdline *cmdline,
/* --- _PyPreConfig ----------------------------------------------- */
PyAPI_FUNC(void) _PyPreConfig_Init(_PyPreConfig *config);
+PyAPI_FUNC(void) _PyPreConfig_InitFromCoreConfig(
+ _PyPreConfig *config,
+ const _PyCoreConfig *coreconfig);
+PyAPI_FUNC(void) _PyPreConfig_InitFromPreConfig(
+ _PyPreConfig *config,
+ const _PyPreConfig *config2);
PyAPI_FUNC(void) _PyPreConfig_Copy(_PyPreConfig *config,
const _PyPreConfig *config2);
PyAPI_FUNC(PyObject*) _PyPreConfig_AsDict(const _PyPreConfig *config);