8000 gh-124044: protect macros expansions in `_cursesmodule.c` using `do { ... } while (0)` constructions by picnixz · Pull Request #124045 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-124044: protect macros expansions in _cursesmodule.c using do { ... } while (0) constructions #124045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
protect PyCursesSetupTermCalled macro expansion
  • Loading branch information
picnixz committed Sep 13, 2024
commit abcb1917233442e7367872a8b738f58101c03ad6
11 changes: 7 additions & 4 deletions Modules/_cursesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,13 @@ static char *screen_encoding = NULL;

/* Utility Macros */
#define PyCursesSetupTermCalled \
if (initialised_setupterm != TRUE) { \
PyErr_SetString(PyCursesError, \
"must call (at least) setupterm() first"); \
return 0; }
do { \
if (initialised_setupterm != TRUE) { \
PyErr_SetString(PyCursesError, \
"must call (at least) setupterm() first"); \
return 0; \
} \
} while (0)

#define PyCursesInitialised \
if (initialised != TRUE) { \
Expand Down
0