summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-27 12:40:14 (GMT)
committerGitHub <noreply@github.com>2019-03-27 12:40:14 (GMT)
commit5ac27a50ff2b42216746fedc0522a92c53089bb3 (patch)
tree5fbf53a0b5e47f6704f01397de3e01799bf87d41 /Include/internal
parent364f0b0f19cc3f0d5e63f571ec9163cf41c62958 (diff)
downloadcpython-5ac27a50ff2b42216746fedc0522a92c53089bb3.zip
cpython-5ac27a50ff2b42216746fedc0522a92c53089bb3.tar.gz
cpython-5ac27a50ff2b42216746fedc0522a92c53089bb3.tar.bz2
bpo-36444: Rework _Py_InitializeFromConfig() API (GH-12576)
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_coreconfig.h76
-rw-r--r--Include/internal/pycore_pylifecycle.h4
2 files changed, 43 insertions, 37 deletions
diff --git a/Include/internal/pycore_coreconfig.h b/Include/internal/pycore_coreconfig.h
index c5f39ba..3a27628 100644
--- a/Include/internal/pycore_coreconfig.h
+++ b/Include/internal/pycore_coreconfig.h
@@ -9,34 +9,6 @@ extern "C" {
#endif
-/* --- _PyPreCmdline ------------------------------------------------- */
-
-typedef struct {
- _PyWstrList argv;
- _PyWstrList xoptions; /* "-X value" option */
- int isolated; /* -I option */
- int use_environment; /* -E option */
- int dev_mode; /* -X dev and PYTHONDEVMODE */
-} _PyPreCmdline;
-
-#define _PyPreCmdline_INIT \
- (_PyPreCmdline){ \
- .use_environment = -1, \
- .isolated = -1, \
- .dev_mode = -1}
-/* Note: _PyPreCmdline_INIT sets other fields to 0/NULL */
-
-PyAPI_FUNC(void) _PyPreCmdline_Clear(_PyPreCmdline *cmdline);
-PyAPI_FUNC(_PyInitError) _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline,
- const _PyArgv *args);
-PyAPI_FUNC(int) _PyPreCmdline_SetCoreConfig(
- const _PyPreCmdline *cmdline,
- _PyCoreConfig *config);
-PyAPI_FUNC(_PyInitError) _PyPreCmdline_Read(_PyPreCmdline *cmdline,
- const _PyPreConfig *preconfig,
- const _PyCoreConfig *coreconfig);
-
-
/* --- _PyWstrList ------------------------------------------------ */
#ifndef NDEBUG
@@ -54,15 +26,17 @@ PyAPI_FUNC(int) _PyWstrList_Extend(_PyWstrList *list,
/* --- _PyArgv ---------------------------------------------------- */
+typedef struct {
+ int argc;
+ int use_bytes_argv;
+ char **bytes_argv;
+ wchar_t **wchar_argv;
+} _PyArgv;
+
PyAPI_FUNC(_PyInitError) _PyArgv_AsWstrList(const _PyArgv *args,
_PyWstrList *list);
-/* --- Py_GetArgcArgv() helpers ----------------------------------- */
-
-PyAPI_FUNC(void) _Py_ClearArgcArgv(void);
-
-
/* --- Helper functions ------------------------------------------- */
PyAPI_FUNC(int) _Py_str_to_int(
@@ -79,15 +53,47 @@ PyAPI_FUNC(void) _Py_get_env_flag(
int *flag,
const char *name);
+/* Py_GetArgcArgv() helper */
+PyAPI_FUNC(void) _Py_ClearArgcArgv(void);
+
+
+/* --- _PyPreCmdline ------------------------------------------------- */
+
+typedef struct {
+ _PyWstrList argv;
+ _PyWstrList xoptions; /* "-X value" option */
+ int isolated; /* -I option */
+ int use_environment; /* -E option */
+ int dev_mode; /* -X dev and PYTHONDEVMODE */
+} _PyPreCmdline;
+
+#define _PyPreCmdline_INIT \
+ (_PyPreCmdline){ \
+ .use_environment = -1, \
+ .isolated = -1, \
+ .dev_mode = -1}
+/* Note: _PyPreCmdline_INIT sets other fields to 0/NULL */
+
+PyAPI_FUNC(void) _PyPreCmdline_Clear(_PyPreCmdline *cmdline);
+PyAPI_FUNC(_PyInitError) _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline,
+ const _PyArgv *args);
+PyAPI_FUNC(int) _PyPreCmdline_SetCoreConfig(
+ const _PyPreCmdline *cmdline,
+ _PyCoreConfig *config);
+PyAPI_FUNC(_PyInitError) _PyPreCmdline_Read(_PyPreCmdline *cmdline,
+ const _PyPreConfig *preconfig);
+
+
/* --- _PyPreConfig ----------------------------------------------- */
PyAPI_FUNC(void) _PyPreConfig_Clear(_PyPreConfig *config);
PyAPI_FUNC(int) _PyPreConfig_Copy(_PyPreConfig *config,
const _PyPreConfig *config2);
PyAPI_FUNC(PyObject*) _PyPreConfig_AsDict(const _PyPreConfig *config);
+PyAPI_FUNC(void) _PyCoreConfig_GetCoreConfig(_PyPreConfig *config,
+ const _PyCoreConfig *core_config);
PyAPI_FUNC(_PyInitError) _PyPreConfig_Read(_PyPreConfig *config,
- const _PyArgv *args,
- const _PyCoreConfig *coreconfig);
+ const _PyArgv *args);
PyAPI_FUNC(_PyInitError) _PyPreConfig_Write(_PyPreConfig *config);
diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h
index 3214d6b..d837ea4 100644
--- a/Include/internal/pycore_pylifecycle.h
+++ b/Include/internal/pycore_pylifecycle.h
@@ -77,8 +77,8 @@ extern void _PyGILState_Fini(void);
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
-PyAPI_FUNC(_PyInitError) _Py_PreInitializeInPlace(
- _PyPreConfig *config);
+PyAPI_FUNC(_PyInitError) _Py_PreInitializeFromCoreConfig(
+ const _PyCoreConfig *coreconfig);
#ifdef __cplusplus
}