summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-12-19 10:35:58 (GMT)
committerGitHub <noreply@github.com>2017-12-19 10:35:58 (GMT)
commit5d8624647d0b8ccb22b17b9e819a8e0c3fb4fe4a (patch)
treeb83a730b4c1711f9d50bf0477f552a714160cf55 /Modules
parent21be85f52030b828679ffb9c8cddb5ac48946a30 (diff)
downloadcpython-5d8624647d0b8ccb22b17b9e819a8e0c3fb4fe4a.zip
cpython-5d8624647d0b8ccb22b17b9e819a8e0c3fb4fe4a.tar.gz
cpython-5d8624647d0b8ccb22b17b9e819a8e0c3fb4fe4a.tar.bz2
bpo-32030: Fix compiler warnings (#4921)
Fix compiler warnings in Py_FinalizeEx(): only define variables if they are needed, add #ifdef. Other cleanup changes: * _PyWarnings_InitWithConfig() is no more needed: call _PyWarnings_Init() instead. * Inline pymain_init_main_interpreter() in its caller. This subfunction is no more justifed.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/main.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 4312ef7..360a085 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -1151,27 +1151,6 @@ pymain_get_program_name(_PyMain *pymain)
}
-/* Initialize the main interpreter.
- *
- * Replaces previous call to Py_Initialize()
- *
- * Return 0 on success.
- * Set pymain->err and return -1 on error.
- */
-static int
-pymain_init_main_interpreter(_PyMain *pymain)
-{
- _PyInitError err;
-
- err = _Py_InitializeMainInterpreter(&pymain->config);
- if (_Py_INIT_FAILED(err)) {
- pymain->err = err;
- return -1;
- }
- return 0;
-}
-
-
static void
pymain_header(_PyMain *pymain)
{
@@ -2357,7 +2336,9 @@ pymain_init_python_main(_PyMain *pymain)
return -1;
}
- if (pymain_init_main_interpreter(pymain)) {
+ err = _Py_InitializeMainInterpreter(&pymain->config);
+ if (_Py_INIT_FAILED(err)) {
+ pymain->err = err;
return -1;
}