aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/coreconfig.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-18 00:38:16 +0200
committerGitHub <noreply@github.com>2019-05-18 00:38:16 +0200
commitb594784272d4907b1c40d3c40d17cb081aa9cf9b (patch)
treea77fe9da72b2879fdd82858160d9b6dbdc67f057 /Python/coreconfig.c
parent4fa7504ee3184cff064e23fe6799e717ed0f9357 (diff)
downloadcpython-b594784272d4907b1c40d3c40d17cb081aa9cf9b.tar.gz
cpython-b594784272d4907b1c40d3c40d17cb081aa9cf9b.zip
bpo-36763: _Py_InitializeFromArgs() argc becomes Py_ssize_t (GH-13396)
* The type of initlization function 'argc' parameters becomes Py_ssize_t, instead of int. * Change _PyPreConfig_Copy() return type to void, instead of int. The function cannot fail anymore. * Fix compilation warnings on Windows.
Diffstat (limited to 'Python/coreconfig.c')
-rw-r--r--Python/coreconfig.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/Python/coreconfig.c b/Python/coreconfig.c
index 3c17e3536d8..fd457262a82 100644
--- a/Python/coreconfig.c
+++ b/Python/coreconfig.c
@@ -1746,7 +1746,7 @@ config_usage(int error, const wchar_t* program)
/* Parse the command line arguments */
static _PyInitError
config_parse_cmdline(_PyCoreConfig *config, _PyWstrList *warnoptions,
- int *opt_index)
+ Py_ssize_t *opt_index)
{
_PyInitError err;
const _PyWstrList *argv = &config->argv;
@@ -2044,7 +2044,7 @@ config_init_warnoptions(_PyCoreConfig *config,
static _PyInitError
-config_update_argv(_PyCoreConfig *config, int opt_index)
+config_update_argv(_PyCoreConfig *config, Py_ssize_t opt_index)
{
const _PyWstrList *cmdline_argv = &config->argv;
_PyWstrList config_argv = _PyWstrList_INIT;
@@ -2105,10 +2105,7 @@ core_read_precmdline(_PyCoreConfig *config, _PyPreCmdline *precmdline)
_PyPreConfig preconfig;
_PyPreConfig_Init(&preconfig);
- if (_PyPreConfig_Copy(&preconfig, &_PyRuntime.preconfig) < 0) {
- err = _Py_INIT_NO_MEMORY();
- return err;
- }
+ _PyPreConfig_Copy(&preconfig, &_PyRuntime.preconfig);
_PyPreConfig_GetCoreConfig(&preconfig, config);
@@ -2145,7 +2142,7 @@ config_read_cmdline(_PyCoreConfig *config)
}
if (config->parse_argv) {
- int opt_index;
+ Py_ssize_t opt_index;
err = config_parse_cmdline(config, &cmdline_warnoptions, &opt_index);
if (_Py_INIT_FAILED(err)) {
goto done;
@@ -2207,7 +2204,7 @@ _PyCoreConfig_SetPyArgv(_PyCoreConfig *config, const _PyArgv *args)
/* Set config.argv: decode argv using Py_DecodeLocale(). Pre-initialize Python
if needed to ensure that encodings are properly configured. */
_PyInitError
-_PyCoreConfig_SetArgv(_PyCoreConfig *config, int argc, char **argv)
+_PyCoreConfig_SetArgv(_PyCoreConfig *config, Py_ssize_t argc, char **argv)
{
_PyArgv args = {
.argc = argc,
@@ -2219,7 +2216,7 @@ _PyCoreConfig_SetArgv(_PyCoreConfig *config, int argc, char **argv)
_PyInitError
-_PyCoreConfig_SetWideArgv(_PyCoreConfig *config, int argc, wchar_t **argv)
+_PyCoreConfig_SetWideArgv(_PyCoreConfig *config, Py_ssize_t argc, wchar_t **argv)
{
_PyArgv args = {
.argc = argc,