summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
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 /Python/_warnings.c
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 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 7b2bdd5..be8370da 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -1173,7 +1173,7 @@ create_filter(PyObject *category, _Py_Identifier *id)
static PyObject *
-init_filters(const _PyCoreConfig *config)
+init_filters(void)
{
#ifdef Py_DEBUG
/* Py_DEBUG builds show all warnings by default */
@@ -1218,8 +1218,8 @@ static struct PyModuleDef warningsmodule = {
};
-PyObject*
-_PyWarnings_InitWithConfig(const _PyCoreConfig *config)
+PyMODINIT_FUNC
+_PyWarnings_Init(void)
{
PyObject *m;
@@ -1228,7 +1228,7 @@ _PyWarnings_InitWithConfig(const _PyCoreConfig *config)
return NULL;
if (_PyRuntime.warnings.filters == NULL) {
- _PyRuntime.warnings.filters = init_filters(config);
+ _PyRuntime.warnings.filters = init_filters();
if (_PyRuntime.warnings.filters == NULL)
return NULL;
}
@@ -1259,12 +1259,3 @@ _PyWarnings_InitWithConfig(const _PyCoreConfig *config)
_PyRuntime.warnings.filters_version = 0;
return m;
}
-
-
-PyMODINIT_FUNC
-_PyWarnings_Init(void)
-{
- PyInterpreterState *interp = PyThreadState_GET()->interp;
- const _PyCoreConfig *config = &interp->core_config;
- return _PyWarnings_InitWithConfig(config);
-}