-
Notifications
You must be signed in to change notification settings - Fork 760
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 missing #[allow(unsafe_code)] attributes #4396
Conversation
a218e65
to
4a6d0bf
Compare
@davidhewitt Do we have a standard way to test this sort of thing? I also noticed we have some other |
Great question. From a quick try, it looks like adding |
4a6d0bf
to
15ace72
Compare
15ace72
to
7e8ff09
Compare
adding ui tests that should pass (for example i added |
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.
Looks good to me, thanks!
Thanks! When can we expect a new release which includes this bugfix (either 0.23 or a backport to 0.22.x)? |
I'm prepping 0.22.3 bugfix which includes this fix, to be released in the coming days. |
See PyO3/pyo3#4396 -- pyo3 now emits some `#[allow(unsafe_code)]` markers, which our previous `forbid(unsafe_code)` was rejecting. Ideally `rustc` would understand that these are not in "our" code (since they're in macro/proc-macro expansions), but that doesn't currently appear to be the case. Signed-off-by: William Woodruff <[email protected]>
Thank you for adding these attributes! FYI, they cause some changes to buildability for crates that disable The fix (in my case) was to weaken See woodruffw/pyrage@68d6617 for an example of the above. |
Yeah, I had to do that in this PR too (https://github.com/PyO3/pyo3/pull/4396/files#diff-2f6330ea73ca5013627fefc12704a0068483a52a99ccf39c781e89dc4ed7a4e1R3). |
Note that this seems to have broken the build for users that declare
|
Does |
Therefore, I changed my code to It is Ok to have this kind of change in macros. Edit: |
Sorry that we broke builds here; that wasn't the intention, and I believed this to be a bugfix based on user reports that this lint was firing in their code. Given that the lint wasn't firing for you despite the Perhaps there is something we can do to adjust our testing methodology and get this partially reverted for 0.22.4. |
Thanks for your helpful and quick answer. Yes, it's a bit puzzling what's really going on. Maybe it depends on the Rust compiler version whether a lint triggers without this Just to be sure I reverted my project back to |
I did a bit of investigation with this reverted and the reproduction from #4394. The lint seems to trigger only on the pyo3/pyo3-macros-backend/src/pymethod.rs Lines 769 to 799 in 0079003
and in contrast to other emitted code with But I'm not really sure why that works. Without an explicitly set |
This reverts commit 0e03b39.
I've staged the revert onto #4575, so we will ship that when we get the other fixes done. |
Fixes #4394.