fix(pyo3-macros): allow pyclass named Probe#5837
Merged
Conversation
Contributor
|
Can you add a testcase for this so we don't regress? |
Contributor
Author
|
I created a copy of this file, but adding a field to the pyo3/tests/ui/pyclass_probe.rs Lines 4 to 19 in 3ffad5a and then a new line with the corresponding filename here: pyo3/tests/test_compile_error.rs Line 95 in 3ffad5a But the test does not fail when I tried locally (before applying my changes, I mean). 🤔 |
26b23af to
fd3c5fe
Compare
Icxolu
reviewed
Feb 24, 2026
Icxolu
reviewed
Feb 24, 2026
Member
Icxolu
left a comment
There was a problem hiding this comment.
We need to revert the commented cfg and add a newsfragment, otherwise I think this looks good.
The `*` import was shadowing the name of the pyclass. The PyMethods trait was only defined for the multiple-pymethods feature, but it cannot be conditionally imported inside the macro. I just defined the trait unconditionally. Fixes PyO3#4792.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
*import was shadowing the name of the pyclass.Fixes #4792.
I tested on a codebase that had one struct/pyclass named Probe, and many other structs/pyclasses.
But I'm not sure if some of the imports that I removed are necessary in other situations that I have not tested.