Skip to content

Commit

Permalink
Add missing #[allow(unsafe_code)] attributes
Browse files Browse the repository at this point in the history
Fixes #4394.
  • Loading branch information
LilyFoote committed Jul 30, 2024
1 parent e0bd22e commit a218e65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyo3-macros-backend/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,7 @@ fn impl_pytypeinfo(cls: &syn::Ident, attr: &PyClassArgs, ctx: &Ctx) -> TokenStre
};

quote! {
#[allow(unsafe_code)]
unsafe impl #pyo3_path::type_object::PyTypeInfo for #cls {
const NAME: &'static str = #cls_name;
const MODULE: ::std::option::Option<&'static str> = #module;
Expand Down
2 changes: 2 additions & 0 deletions pyo3-macros-backend/src/pymethod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,15 @@ pub fn impl_py_getter_def(
use #pyo3_path::impl_::pyclass::Probe;

struct Offset;
#[allow(unsafe_code)]
unsafe impl #pyo3_path::impl_::pyclass::OffsetCalculator<#cls, #ty> for Offset {
fn offset() -> usize {
#pyo3_path::impl_::pyclass::class_offset::<#cls>() +
#pyo3_path::impl_::pyclass::offset_of!(#cls, #field)
}
}

#[allow(unsafe_code)]
const GENERATOR: #pyo3_path::impl_::pyclass::PyClassGetterGenerator::<
#cls,
#ty,
Expand Down

0 comments on commit a218e65

Please sign in to comment.