summaryrefslogtreecommitdiffstats
path: root/Python/initconfig.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-10-01 10:26:04 (GMT)
committerGitHub <noreply@github.com>2019-10-01 10:26:04 (GMT)
commitd49f096cc41f57155efe71cd089c29b38c218488 (patch)
tree1830b017fe1259e6d5cc27390f0331a83b7d8ba2 /Python/initconfig.c
parent938c00ca9e4207a2531041edff2e82490b02047f (diff)
downloadcpython-d49f096cc41f57155efe71cd089c29b38c218488.zip
cpython-d49f096cc41f57155efe71cd089c29b38c218488.tar.gz
cpython-d49f096cc41f57155efe71cd089c29b38c218488.tar.bz2
bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)
PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no longer return PyStatus: they cannot fail anymore. (cherry picked from commit 8462a4936b3a551dc546a6adea04a70b0a07ca67) Co-authored-by: Victor Stinner <vstinner@redhat.com>
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r--Python/initconfig.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 9164c7c..a41a329 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -569,7 +569,7 @@ PyConfig_Clear(PyConfig *config)
}
-PyStatus
+void
_PyConfig_InitCompatConfig(PyConfig *config)
{
memset(config, 0, sizeof(*config));
@@ -603,17 +603,13 @@ _PyConfig_InitCompatConfig(PyConfig *config)
#ifdef MS_WINDOWS
config->legacy_windows_stdio = -1;
#endif
- return _PyStatus_OK();
}
-static PyStatus
+static void
config_init_defaults(PyConfig *config)
{
- PyStatus status = _PyConfig_InitCompatConfig(config);
- if (_PyStatus_EXCEPTION(status)) {
- return status;
- }
+ _PyConfig_InitCompatConfig(config);
config->isolated = 0;
config->use_environment = 1;
@@ -632,35 +628,24 @@ config_init_defaults(PyConfig *config)
#ifdef MS_WINDOWS
config->legacy_windows_stdio = 0;
#endif
- return _PyStatus_OK();
}
-PyStatus
+void
PyConfig_InitPythonConfig(PyConfig *config)
{
- PyStatus status = config_init_defaults(config);
- if (_PyStatus_EXCEPTION(status)) {
- _PyStatus_UPDATE_FUNC(status);
- return status;
- }
+ config_init_defaults(config);
config->_config_init = (int)_PyConfig_INIT_PYTHON;
config->configure_c_stdio = 1;
config->parse_argv = 1;
-
- return _PyStatus_OK();
}
-PyStatus
+void
PyConfig_InitIsolatedConfig(PyConfig *config)
{
- PyStatus status = config_init_defaults(config);
- if (_PyStatus_EXCEPTION(status)) {
- _PyStatus_UPDATE_FUNC(status);
- return status;
- }
+ config_init_defaults(config);
config->_config_init = (int)_PyConfig_INIT_ISOLATED;
config->isolated = 1;
@@ -675,8 +660,6 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
#ifdef MS_WINDOWS
config->legacy_windows_stdio = 0;
#endif
-
- return _PyStatus_OK();
}