summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-25 17:37:10 (GMT)
committerGitHub <noreply@github.com>2019-03-25 17:37:10 (GMT)
commita6fbc4e25e1dc7d1c9a26888b9115bc6c2afc101 (patch)
treeb45a6288d1bb5ac1e1df81a0b8c2fc616bc01f44 /Include
parentf72346c47537657a287a862305f65eb5d7594fbf (diff)
downloadcpython-a6fbc4e25e1dc7d1c9a26888b9115bc6c2afc101.zip
cpython-a6fbc4e25e1dc7d1c9a26888b9115bc6c2afc101.tar.gz
cpython-a6fbc4e25e1dc7d1c9a26888b9115bc6c2afc101.tar.bz2
bpo-36301: Add _Py_PreInitializeFromConfig() (GH-12536)
* Initialize _PyPreConfig.dev_mode to -1. * _PyPreConfig_Read(): coreconfig has the priority over preconfig. * _PyCoreConfig_Read() now calls _PyPreCmdline_Read() internally. * config_from_cmdline() now pass _PyPreCmdline to config_read(). * Add _PyPreCmdline_Copy().
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/coreconfig.h4
-rw-r--r--Include/cpython/pylifecycle.h2
-rw-r--r--Include/internal/pycore_coreconfig.h14
3 files changed, 18 insertions, 2 deletions
diff --git a/Include/cpython/coreconfig.h b/Include/cpython/coreconfig.h
index 8362209..bb086cb 100644
--- a/Include/cpython/coreconfig.h
+++ b/Include/cpython/coreconfig.h
@@ -115,7 +115,9 @@ typedef struct {
.isolated = -1, \
.use_environment = -1, \
.coerce_c_locale = -1, \
- .utf8_mode = -1}
+ .utf8_mode = -1, \
+ .dev_mode = -1, \
+ .allocator = NULL}
/* --- _PyCoreConfig ---------------------------------------------- */
diff --git a/Include/cpython/pylifecycle.h b/Include/cpython/pylifecycle.h
index 1caeb98..a226de8 100644
--- a/Include/cpython/pylifecycle.h
+++ b/Include/cpython/pylifecycle.h
@@ -17,6 +17,8 @@ PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
PyAPI_FUNC(_PyInitError) _Py_PreInitialize(void);
PyAPI_FUNC(_PyInitError) _Py_PreInitializeFromPreConfig(
_PyPreConfig *preconfig);
+PyAPI_FUNC(_PyInitError) _Py_PreInitializeFromConfig(
+ const _PyCoreConfig *coreconfig);
PyAPI_FUNC(_PyInitError) _Py_InitializeCore(
PyInterpreterState **interp,
diff --git a/Include/internal/pycore_coreconfig.h b/Include/internal/pycore_coreconfig.h
index 949bc9b..d44172e 100644
--- a/Include/internal/pycore_coreconfig.h
+++ b/Include/internal/pycore_coreconfig.h
@@ -25,11 +25,22 @@ 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(
+ const _PyPreCmdline *cmdline,
+ _PyCoreConfig *config);
PyAPI_FUNC(_PyInitError) _PyPreCmdline_Read(_PyPreCmdline *cmdline);
@@ -77,7 +88,8 @@ PyAPI_FUNC(void) _Py_get_env_flag(_PyPreConfig *config,
int *flag,
const char *name);
PyAPI_FUNC(_PyInitError) _PyPreConfig_Read(_PyPreConfig *config,
- const _PyArgv *args);
+ const _PyArgv *args,
+ const _PyCoreConfig *coreconfig);
PyAPI_FUNC(int) _PyPreConfig_AsDict(const _PyPreConfig *config,
PyObject *dict);
PyAPI_FUNC(_PyInitError) _PyPreConfig_ReadFromArgv(_PyPreConfig *config,