-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error messages for unsupported macro features on compilation #4194
Add error messages for unsupported macro features on compilation #4194
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this at the PyCon sprints! 🚀
It looks like there's a compile error on the pipeline still:
error: `weakref` requires >= python 3.9 with the `abi3` feature
--> src/tests/hygiene/pyclass.rs:16:5
|
16 | weakref,
| ^^^^^^^
I'd suggest having a look at that file and moving the weakref
flag to a separate #[cfg_attr(any(Py_3_9, not(Py_LIMITED_API)), pyo3(weakref))]
.
@davidhewitt this is ready for another review |
It looks like the pipeline is still failing with this same error. I think you should be able to reproduce by running |
bc9a80e
to
3f5d1bc
Compare
Co-authored-by: David Hewitt <[email protected]>
Co-authored-by: David Hewitt <[email protected]>
Co-authored-by: David Hewitt <[email protected]>
This reverts commit 6c8a2ee.
Co-authored-by: Icxolu <[email protected]>
Co-authored-by: David Hewitt <[email protected]>
After making the suggested change, we are getting the following error:
How do I fix this? Do I need to add an import? Rust Rover doesn't give any suggestions. |
Ungh, I realise now that with that suggestion I've blundered right into #2786 (and similar pains around I think the solution for now here would be to still use So something like #[cfg_attr(any(Py_3_9, not(Py_LIMITED_API)), crate::pyclass(name = "ActuallyBar", ..., weakref))]
#[cfg_attr(not(any(Py_3_9, not(Py_LIMITED_API))), crate::pyclass(name = "ActuallyBar", ...))]
pub struct Bar { |
I made this change and it gives a compiler error. I don't know rust well enough to even guess how to fix it. Do you have any suggestions? |
…ror-messages-for-unsupported-macro-features-on-compilation # Conflicts: # pyo3-macros-backend/src/pyclass.rs
I pushed a commit to apply something which should work as per #4194 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should now (hopefully) merge, many thanks!
Ah, there was a lot of adjustment to conditional compilation to follow up where our own test suite had been silently ignoring the missing behaviour. Good to find that this makes us in a better place! 😂 |
tests/test_unsendable_dict.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged these tests into test_class_basics
.
I think the CI failure arises due to divergence between how we check for abi3 here and how |
Where are we at with this PR? What can I do to get it over the line? |
@codeguru42 great question! After the last updates I pushed, I think this PR should in principle be good to merge. But naturally, making these error messages emerge properly has uncovered two pain points that I've been fixing separately. First there was #4237 which fixed a divergence between how we were setting the And then now the tests have picked up an old bug that's my fault with the 3.9 implementation, which I opened this morning in #4251. My hope is that once that PR is merged, we'll be able to merge this one without further modifications 👀 |
…ror-messages-for-unsupported-macro-features-on-compilation # Conflicts: # tests/test_class_basics.rs
@davidhewitt I merged main into this branch and resolved conflicts. But I have one question for clarification. As you can see in 3c7e898. |
Yep I think |
Hooray, success finally! 🎉 Thanks again @codeguru42 and great to meet you at PyCon 👍 |
Closes #3945. I probably don't have permissions to do this...but thought I'd see if a comment would do it. Maybe needed it in the description before merging? |
Continues the work from #3993
Error messages for
weakref
anddict
.