bpo-36444: Rework _Py_InitializeFromConfig() API (GH-12576)
diff --git a/Python/preconfig.c b/Python/preconfig.c
index ce63ef0..011ed53 100644
--- a/Python/preconfig.c
+++ b/Python/preconfig.c
@@ -148,22 +148,6 @@
}
-static void
-_PyPreCmdline_GetCoreConfig(_PyPreCmdline *cmdline, const _PyCoreConfig *config)
-{
-#define COPY_ATTR(ATTR) \
- if (config->ATTR != -1) { \
- cmdline->ATTR = config->ATTR; \
- }
-
- COPY_ATTR(isolated);
- COPY_ATTR(use_environment);
- COPY_ATTR(dev_mode);
-
-#undef COPY_ATTR
-}
-
-
int
_PyPreCmdline_SetCoreConfig(const _PyPreCmdline *cmdline, _PyCoreConfig *config)
{
@@ -231,17 +215,12 @@
_PyInitError
_PyPreCmdline_Read(_PyPreCmdline *cmdline,
- const _PyPreConfig *preconfig,
- const _PyCoreConfig *coreconfig)
+ const _PyPreConfig *preconfig)
{
if (preconfig) {
_PyPreCmdline_GetPreConfig(cmdline, preconfig);
}
- if (coreconfig) {
- _PyPreCmdline_GetCoreConfig(cmdline, coreconfig);
- }
-
_PyInitError err = precmdline_parse_cmdline(cmdline);
if (_Py_INIT_FAILED(err)) {
return err;
@@ -373,6 +352,23 @@
}
+void
+_PyCoreConfig_GetCoreConfig(_PyPreConfig *config,
+ const _PyCoreConfig *core_config)
+{
+#define COPY_ATTR(ATTR) \
+ if (core_config->ATTR != -1) { \
+ config->ATTR = core_config->ATTR; \
+ }
+
+ COPY_ATTR(isolated);
+ COPY_ATTR(use_environment);
+ COPY_ATTR(dev_mode);
+
+#undef COPY_ATTR
+}
+
+
static void
_PyPreConfig_GetGlobalConfig(_PyPreConfig *config)
{
@@ -640,12 +636,11 @@
static _PyInitError
-preconfig_read(_PyPreConfig *config, _PyPreCmdline *cmdline,
- const _PyCoreConfig *coreconfig)
+preconfig_read(_PyPreConfig *config, _PyPreCmdline *cmdline)
{
_PyInitError err;
- err = _PyPreCmdline_Read(cmdline, config, coreconfig);
+ err = _PyPreCmdline_Read(cmdline, config);
if (_Py_INIT_FAILED(err)) {
return err;
}
@@ -692,8 +687,7 @@
- Py_xxx global configuration variables
- the LC_CTYPE locale */
_PyInitError
-_PyPreConfig_Read(_PyPreConfig *config, const _PyArgv *args,
- const _PyCoreConfig *coreconfig)
+_PyPreConfig_Read(_PyPreConfig *config, const _PyArgv *args)
{
_PyInitError err;
@@ -756,7 +750,7 @@
Py_LegacyWindowsFSEncodingFlag = config->legacy_windows_fs_encoding;
#endif
- err = preconfig_read(config, &cmdline, coreconfig);
+ err = preconfig_read(config, &cmdline);
if (_Py_INIT_FAILED(err)) {
goto done;
}