Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-36301: Fix _PyPreConfig_Read() compiler warning#12695

Merged
vstinner merged 1 commit into
python:masterpython/cpython:masterfrom
vstinner:preconfig_fix_warnCopy head branch name to clipboard
Apr 5, 2019
Merged

bpo-36301: Fix _PyPreConfig_Read() compiler warning#12695
vstinner merged 1 commit into
python:masterpython/cpython:masterfrom
vstinner:preconfig_fix_warnCopy head branch name to clipboard

Conversation

@vstinner

@vstinner vstinner commented Apr 5, 2019

Copy link
Copy Markdown
Member

Initialize init_utf8_mode earlier to fix a compiler warning.

https://bugs.python.org/issue36301

Initialize init_utf8_mode earlier to fix a compiler warning.
@vstinner

vstinner commented Apr 5, 2019

Copy link
Copy Markdown
Member Author

Example of warning seen on PR #12661:

https://dev.azure.com/Python/cpython/_build/results?buildId=40348

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.

@tirkarthi

Copy link
Copy Markdown
Member

See also #12644 . Does this PR also fix the same issue ?

@vstinner vstinner merged commit 6a8c313 into python:master Apr 5, 2019
@vstinner vstinner deleted the preconfig_fix_warn branch April 5, 2019 09:44
@vstinner

vstinner commented Apr 5, 2019

Copy link
Copy Markdown
Member Author

See also #12644 . Does this PR also fix the same issue ?

Thanks. I missed this PR, thanks for the pointer. I closed this PR as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.