Skip to content

Re-exporting pyo3 breaks macros #1978

Discussion options

You must be logged in to vote

I think this is one of those things where it hurts both ways around.

As the other answers say, we felt it was better to anchor the macros to the global scope rather than relying on pyo3 being defined correctly at in the current scope. This leads to fewer suprises where PyO3 (or std) can be overridden in the local scope with unexpected effects.

OTOH, I can certainly appreciate your use case wanting to write use my_crate::pyo3 to override what the macros look at. I think a number of proc macro crates are in similar positions where it's not clear what's better on this front. I'm happy with what we currently do because it's more robust, however am not against reconsidering.

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@GrinningSoulGH
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by GrinningSoulGH
Comment options

You must be logged in to vote
1 reply
@davidhewitt
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants