]> granicus.if.org Git - python/commitdiff
Initialize a variable to make the compiler happy. (GH-9153)
authorBenjamin Peterson <benjamin@python.org>
Tue, 11 Sep 2018 22:11:06 +0000 (15:11 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Sep 2018 22:11:06 +0000 (15:11 -0700)
GCC complains:

Python/pylifecycle.c: In function ‘_Py_InitializeFromConfig’:
Python/pylifecycle.c:900:13: warning: ‘interp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         err = _Py_InitializeMainInterpreter(interp, &main_config);
         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This seems spurious since &interp is passed to _Py_InitializeCore. Anyway, we
can easily initialize to quiet the warning.

Python/pylifecycle.c

index 33ca802fd56dd6facceb8845c3ba3af542b44b88..379e860b5ba4b4eac123ef3bb00e366ad45a8ca8 100644 (file)
@@ -886,7 +886,7 @@ _Py_InitializeMainInterpreter(PyInterpreterState *interp,
 _PyInitError
 _Py_InitializeFromConfig(const _PyCoreConfig *config)
 {
-    PyInterpreterState *interp;
+    PyInterpreterState *interp = NULL;
     _PyInitError err;
     err = _Py_InitializeCore(&interp, config);
     if (_Py_INIT_FAILED(err)) {