Skip to content

[3.12] gh-130740: Move some stdbool.h includes after Python.h (#130738) #130757

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

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Mar 2, 2025

chouquette and others added 2 commits March 2, 2025 11:05
…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 picnixz marked this pull request as ready for review March 2, 2025 10:38
@picnixz
Copy link
Member Author

picnixz commented Mar 3, 2025

For this one, I'd like approval from @markshannon as I modified the generator cases.

@@ -986,6 +986,9 @@ def write_metadata(self) -> None:
self.out.write_raw(self.from_source_files())
self.out.write_raw(f"// Do not edit!\n")

self.out.write_raw("\n")
self.out.write_raw("#include <stdbool.h>")
Copy link
Member

Choose a reason for hiding this comment

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

Why do you add <stdbool.h> include?

Copy link
Member Author

@picnixz picnixz Mar 3, 2025

Choose a reason for hiding this comment

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

Because there are some bool inside the generate_metadata.h file which, without this include, doesn't compile. Previously, it was because we included stdbool.h before including this file so it was impliticitly available (see https://github.com/python/cpython/actions/runs/13614386994/job/38055588576?pr=130757)

@markshannon
Copy link
Member

The change to Tools/cases_generator/generate_cases.py seems fine. Harmless at worst.

@markshannon
Copy link
Member

Don't the generated files need to be regenerated?

@picnixz
Copy link
Member Author

picnixz commented Mar 3, 2025

Don't the generated files need to be regenerated?

I should have regenerated them? efd75da#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498. Or are there more rules that I needed to run?

@vstinner
Copy link
Member

vstinner commented Mar 3, 2025

I downloaded the PR and ran make regen-all: there is no change.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@picnixz
Copy link
Member Author

picnixz commented Mar 3, 2025

make regen-all

I think some of the targets need to be regenerated separately (this may include the regen-cases but I don't remember well) The other files that could have been regenerated are generated_cases.c.h but I'm not changing their output as they don't have a "bool" (or at least my compiler didn't complain about it). What really mattered was opcode_metadata.h.

EDIT: regen-all was sufficient, my bad!

@picnixz picnixz self-assigned this Mar 3, 2025
@picnixz picnixz merged commit 7ce5f15 into python:3.12 Mar 4, 2025
31 checks passed
@picnixz picnixz deleted the bp/312/214562ed4ddc248b007f718ed92ebcc0c3669611-130740 branch March 4, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants