Skip to content

Conversation

@davidhewitt
Copy link
Member

Inspired by what I learned working on #5551 (not exactly split from that diff, but I like this more).

This PR refactors the internals of our #[pymethods] and #[pyfunction] codegen so that we don't define an extern "C" function on each invocation but instead pick them up from generic implementations defined in src/impl_/trampoline.rs.

The changes to trampoline.rs are the material part of this diff; each trampoline is reworked to be a generic portion (which takes the target function to call as a generic argument) and a concrete inner. The rest of the diff is just adjustments to reference these generic functions (by way of a helper get_trampoline_function! macro).

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Nov 1, 2025
@davidhewitt davidhewitt mentioned this pull request Nov 8, 2025
@Icxolu Icxolu added this pull request to the merge queue Nov 11, 2025
Merged via the queue into PyO3:main with commit 8265130 Nov 11, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-skip-changelog Skip checking changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants