Skip to content

Properly add link attributes to extern static pointer bindings - #44

Open
emmatyping wants to merge 2 commits into
3.x-rust-in-cpythonfrom
emmatyping/fix-extern-static-parsing
Open

Properly add link attributes to extern static pointer bindings#44
emmatyping wants to merge 2 commits into
3.x-rust-in-cpythonfrom
emmatyping/fix-extern-static-parsing

Conversation

@emmatyping

Copy link
Copy Markdown

The previous manual parsing for cpython-sys was not robust to different bindgen outputs. Rather than manual parsing, we now use syn and prettyplease to parse/unparse the bindgen output. These are not actually new dependencies as bindgen already depends on them.

The previous implementation of parsing was not properly handling some bindgen output (e.g. everything could end up on one line), so linker attributes were not added to items like PyExc_TypeError, causing link-time errors.

This should fix the Windows build errors seen in #35.

The previous manual parsing for cpython-sys was
not robust to different bindgen outputs. Rather
than manual parsing, we now use syn and
prettyplease to parse the bindgen output.
@emmatyping
emmatyping requested a review from Eclips4 August 10, 2026 05:10
Comment thread Modules/cpython-sys/build.rs
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.

2 participants