Skip to content

gh-152813: Fix curses build warning on macOS#152814

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
hrimov:fix/curses-warning
Jul 2, 2026
Merged

gh-152813: Fix curses build warning on macOS#152814
serhiy-storchaka merged 1 commit into
python:mainfrom
hrimov:fix/curses-warning

Conversation

@hrimov

@hrimov hrimov commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #152813

Assigning the macro's result to a variable before comparing keeps clang from constant-folding the comparison and flagging the branch as dead code.

Comment thread Modules/_cursesmodule.c
cursesmodule_state *state = get_cursesmodule_state_by_win(self);
#ifdef HAVE_NCURSESW
if (wgetbkgrnd(self->win, &wcval) == ERR) {
int rtn = wgetbkgrnd(self->win, &wcval); /* avoid -Wunreachable-code on macOS */

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.

Is this the only function triggering a warning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, didn't observe any others

@serhiy-storchaka serhiy-storchaka 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. 👍

@serhiy-storchaka serhiy-storchaka merged commit 369ce43 into python:main Jul 2, 2026
59 checks passed
@serhiy-storchaka

Copy link
Copy Markdown
Member

Thank you for your contribution.

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.

Curses build warning on macOS

2 participants