Skip to content

Ensure stdbool.h is included after Python.h #130740

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

Closed
picnixz opened this issue Mar 1, 2025 · 1 comment
Closed

Ensure stdbool.h is included after Python.h #130740

picnixz opened this issue Mar 1, 2025 · 1 comment
Labels
build The build process and cross-build extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@picnixz
Copy link
Member

picnixz commented Mar 1, 2025

Bug report

Including stdbool.h before Python.h may cause build issues when using zig cc.

See #130641 and #130641 (comment).

Linked PRs

@picnixz picnixz added build The build process and cross-build extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Mar 1, 2025
picnixz pushed a commit that referenced this issue Mar 2, 2025
Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not
included first and when we are in a platform-agnostic context. This is to avoid having
features defined by `stdbool.h` before those decided by `Python.h`.
picnixz pushed a commit to picnixz/cpython that referenced this issue Mar 2, 2025
…hon#130738)

Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not
included first and when we are in a platform-agnostic context. This is to avoid having
features defined by `stdbool.h` before those decided by `Python.h`.
picnixz added a commit that referenced this issue Mar 3, 2025
…30738) (#130756)

gh-130740: Move some `stdbool.h` includes after `Python.h` (#130738)

Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not
included first and when we are in a platform-agnostic context. This is to avoid having
features defined by `stdbool.h` before those decided by `Python.h` (this caused some
build failures when compiling CPython with `zig cc`).

(cherry-picked from commit 214562e)

---------

Co-authored-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
picnixz added a commit that referenced this issue Mar 4, 2025
…30738) (#130757)

gh-130740: Move some `stdbool.h` includes after `Python.h` (#130738)

Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not
included first and when we are in a platform-agnostic context. This is to avoid having
features defined by `stdbool.h` before those decided by `Python.h` (this caused some
build failures when compiling CPython with `zig cc`).

(cherry-picked from commit 214562e)

---------

Co-authored-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
@StanFromIreland
Copy link
Contributor

StanFromIreland commented Mar 4, 2025

Can this be closed, are there any cases of this left?

$ grep -RPzl '#include <stdbool.h>.*\n(?s:.*)#include <Python.h>' .
./configure

I presume we can ignore it.

@picnixz picnixz closed this as completed Mar 4, 2025
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…hon#130738)

Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not
included first and when we are in a platform-agnostic context. This is to avoid having
features defined by `stdbool.h` before those decided by `Python.h`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants