Skip to content

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

Merged
emmatyping merged 2 commits into
3.x-rust-in-cpythonfrom
emmatyping/fix-extern-static-parsing
Aug 17, 2026
Merged

Properly add link attributes to extern static pointer bindings#44
emmatyping merged 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
@emmatyping
emmatyping merged commit 1694fc7 into 3.x-rust-in-cpython Aug 17, 2026
80 of 87 checks passed
@emmatyping
emmatyping deleted the emmatyping/fix-extern-static-parsing branch August 17, 2026 06:43
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.

3 participants