Skip to content

gh-125517: Fix unreachable code warnings in _testembed.c#125518

Merged
sobolevn merged 3 commits into
python:mainfrom
sobolevn:issue-125517
Oct 15, 2024
Merged

gh-125517: Fix unreachable code warnings in _testembed.c#125518
sobolevn merged 3 commits into
python:mainfrom
sobolevn:issue-125517

Conversation

@sobolevn

@sobolevn sobolevn commented Oct 15, 2024

Copy link
Copy Markdown
Member

@sobolevn sobolevn requested a review from vstinner October 15, 2024 12:26
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Oct 15, 2024

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update also the documentation: https://docs.python.org/dev/c-api/init_config.html#id1

Yeah, it's annoying, it's not possible to declare err_msg in the error label :-(

@vstinner

Copy link
Copy Markdown
Member

An alternative is to use braces to declare a local scope:

error:
    {
        const char *err_msg;
        (void)PyInitConfig_GetError(config, &err_msg);
        printf("Python init failed: %s\n", err_msg);
    }
    ...

@sobolevn

Copy link
Copy Markdown
Member Author

I like the braces idea! Will do. Thanks for the quick review!

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread Doc/c-api/init_config.rst
@sobolevn

Copy link
Copy Markdown
Member Author

Thanks! Addressed the last comment as well.

@sobolevn sobolevn enabled auto-merge (squash) October 15, 2024 12:47
@sobolevn sobolevn merged commit c8a1818 into python:main Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants