summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-26 15:58:50 (GMT)
committerGitHub <noreply@github.com>2019-03-26 15:58:50 (GMT)
commitf8ba6f5afc317d1be3025db1be410ac66a7e5a27 (patch)
tree531f75949653a2843d2834f253d26f5d366e6111 /Include/internal
parent414b1cde93764cdabb0798b02af4dd7df954424d (diff)
downloadcpython-f8ba6f5afc317d1be3025db1be410ac66a7e5a27.zip
cpython-f8ba6f5afc317d1be3025db1be410ac66a7e5a27.tar.gz
cpython-f8ba6f5afc317d1be3025db1be410ac66a7e5a27.tar.bz2
bpo-36301: Cleanup preconfig.c and coreconfig.c (GH-12563)
* _PyCoreConfig_Write() now updates _PyRuntime.preconfig * Remove _PyPreCmdline_Copy() * _PyPreCmdline_Read() now accepts _PyPreConfig and _PyCoreConfig optional configurations. * Rename _PyPreConfig_ReadFromArgv() to _PyPreConfig_Read(). Simplify the code. * Calling _PyCoreConfig_Read() no longer adds the warning options twice: don't add a warning option if it's already in the list. * Rename _PyCoreConfig_ReadFromArgv() to _PyCoreConfig_Read(). * Rename config_from_cmdline() to _PyCoreConfig_ReadFromArgv(). * Add more assertions on _PyCoreConfig in _PyCoreConfig_Read(). * Move some functions. * Make some config functions private.
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_coreconfig.h44
1 files changed, 16 insertions, 28 deletions
diff --git a/Include/internal/pycore_coreconfig.h b/Include/internal/pycore_coreconfig.h
index d79f590..dad5d3f 100644
--- a/Include/internal/pycore_coreconfig.h
+++ b/Include/internal/pycore_coreconfig.h
@@ -14,8 +14,8 @@ extern "C" {
typedef struct {
_PyWstrList argv;
_PyWstrList xoptions; /* "-X value" option */
- int use_environment; /* -E option */
int isolated; /* -I option */
+ int use_environment; /* -E option */
int dev_mode; /* -X dev and PYTHONDEVMODE */
} _PyPreCmdline;
@@ -27,23 +27,14 @@ typedef struct {
/* Note: _PyPreCmdline_INIT sets other fields to 0/NULL */
PyAPI_FUNC(void) _PyPreCmdline_Clear(_PyPreCmdline *cmdline);
-PyAPI_FUNC(int) _PyPreCmdline_Copy(_PyPreCmdline *cmdline,
- const _PyPreCmdline *cmdline2);
PyAPI_FUNC(_PyInitError) _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline,
const _PyArgv *args);
-PyAPI_FUNC(void) _PyPreCmdline_GetPreConfig(
- _PyPreCmdline *cmdline,
- const _PyPreConfig *config);
-PyAPI_FUNC(void) _PyPreCmdline_SetPreConfig(
- const _PyPreCmdline *cmdline,
- _PyPreConfig *config);
-PyAPI_FUNC(void) _PyPreCmdline_GetCoreConfig(
- _PyPreCmdline *cmdline,
- const _PyCoreConfig *config);
-PyAPI_FUNC(void) _PyPreCmdline_SetCoreConfig(
+PyAPI_FUNC(int) _PyPreCmdline_SetCoreConfig(
const _PyPreCmdline *cmdline,
_PyCoreConfig *config);
-PyAPI_FUNC(_PyInitError) _PyPreCmdline_Read(_PyPreCmdline *cmdline);
+PyAPI_FUNC(_PyInitError) _PyPreCmdline_Read(_PyPreCmdline *cmdline,
+ const _PyPreConfig *preconfig,
+ const _PyCoreConfig *coreconfig);
/* --- _PyWstrList ------------------------------------------------ */
@@ -57,6 +48,8 @@ PyAPI_FUNC(int) _PyWstrList_Copy(_PyWstrList *list,
PyAPI_FUNC(int) _PyWstrList_Append(_PyWstrList *list,
const wchar_t *item);
PyAPI_FUNC(PyObject*) _PyWstrList_AsList(const _PyWstrList *list);
+PyAPI_FUNC(int) _PyWstrList_Extend(_PyWstrList *list,
+ const _PyWstrList *list2);
/* --- _PyArgv ---------------------------------------------------- */
@@ -70,7 +63,7 @@ PyAPI_FUNC(_PyInitError) _PyArgv_AsWstrList(const _PyArgv *args,
PyAPI_FUNC(void) _Py_ClearArgcArgv(void);
-/* --- _PyPreConfig ----------------------------------------------- */
+/* --- Helper functions ------------------------------------------- */
PyAPI_FUNC(int) _Py_str_to_int(
const char *str,
@@ -81,22 +74,20 @@ PyAPI_FUNC(const wchar_t*) _Py_get_xoption(
PyAPI_FUNC(const char*) _Py_GetEnv(
int use_environment,
const char *name);
-
-PyAPI_FUNC(void) _PyPreConfig_Clear(_PyPreConfig *config);
-PyAPI_FUNC(int) _PyPreConfig_Copy(_PyPreConfig *config,
- const _PyPreConfig *config2);
-PyAPI_FUNC(void) _PyPreConfig_GetGlobalConfig(_PyPreConfig *config);
-PyAPI_FUNC(void) _PyPreConfig_SetGlobalConfig(const _PyPreConfig *config);
PyAPI_FUNC(void) _Py_get_env_flag(
int use_environment,
int *flag,
const char *name);
+
+/* --- _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(_PyInitError) _PyPreConfig_Read(_PyPreConfig *config,
const _PyArgv *args,
const _PyCoreConfig *coreconfig);
-PyAPI_FUNC(PyObject*) _PyPreConfig_AsDict(const _PyPreConfig *config);
-PyAPI_FUNC(_PyInitError) _PyPreConfig_ReadFromArgv(_PyPreConfig *config,
- const _PyArgv *args);
PyAPI_FUNC(_PyInitError) _PyPreConfig_Write(_PyPreConfig *config);
@@ -109,10 +100,7 @@ PyAPI_FUNC(int) _PyCoreConfig_Copy(
PyAPI_FUNC(_PyInitError) _PyCoreConfig_InitPathConfig(_PyCoreConfig *config);
PyAPI_FUNC(_PyInitError) _PyCoreConfig_SetPathConfig(
const _PyCoreConfig *config);
-PyAPI_FUNC(void) _PyCoreConfig_GetGlobalConfig(_PyCoreConfig *config);
-PyAPI_FUNC(void) _PyCoreConfig_SetGlobalConfig(const _PyCoreConfig *config);
-PyAPI_FUNC(_PyInitError) _PyCoreConfig_Read(_PyCoreConfig *config);
-PyAPI_FUNC(_PyInitError) _PyCoreConfig_ReadFromArgv(_PyCoreConfig *config,
+PyAPI_FUNC(_PyInitError) _PyCoreConfig_Read(_PyCoreConfig *config,
const _PyArgv *args);
PyAPI_FUNC(void) _PyCoreConfig_Write(const _PyCoreConfig *config);