bpo-36301: Fix _PyPreConfig_Read() compiler warning by vstinner · Pull Request #12695 · python/cpython
Python/preconfig.c:725:13: warning: variable 'init_utf8_mode' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (_Py_INIT_FAILED(err)) {
^~~~~~~~~~~~~~~~~~~~
./Include/cpython/coreconfig.h:37:5: note: expanded from macro '_Py_INIT_FAILED'
(err.msg != NULL || err.exitcode != -1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Python/preconfig.c:815:19: note: uninitialized use occurs here
Py_UTF8Mode = init_utf8_mode ;
^~~~~~~~~~~~~~
Python/preconfig.c:725:9: note: remove the 'if' if its condition is always false
if (_Py_INIT_FAILED(err)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~
Python/preconfig.c:725:29: warning: variable 'init_utf8_mode' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
if (_Py_INIT_FAILED(err)) {
~~~~~~~~~~~~~~~~^~~~
./Include/cpython/coreconfig.h:37:6: note: expanded from macro '_Py_INIT_FAILED'
(err.msg != NULL || err.exitcode != -1)
^~~~~~~~~~~~~~~
Python/preconfig.c:815:19: note: uninitialized use occurs here
Py_UTF8Mode = init_utf8_mode ;
^~~~~~~~~~~~~~
Python/preconfig.c:725:29: note: remove the '||' if its condition is always false
if (_Py_INIT_FAILED(err)) {
^
Python/preconfig.c:730:5: note: variable 'init_utf8_mode' is declared here
int init_utf8_mode = Py_UTF8Mode;
^
2 warnings generated.