Skip to content
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

Small fixes #4567

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/4567.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix compiler warning about non snake case method names inside `#[pymethods]` generated code.
2 changes: 1 addition & 1 deletion pyo3-macros-backend/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl PyClassArgs {
})
}

pub fn parse_stuct_args(input: ParseStream<'_>) -> syn::Result<Self> {
pub fn parse_struct_args(input: ParseStream<'_>) -> syn::Result<Self> {
Self::parse(input, PyClassKind::Struct)
}

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 @@ -1295,6 +1295,7 @@ impl SlotDef {
let name = spec.name;
let holders = holders.init_holders(ctx);
let associated_method = quote! {
#[allow(non_snake_case)]
unsafe fn #wrapper_ident(
py: #pyo3_path::Python<'_>,
_raw_slf: *mut #pyo3_path::ffi::PyObject,
Expand Down Expand Up @@ -1418,6 +1419,7 @@ impl SlotFragmentDef {
let holders = holders.init_holders(ctx);
Ok(quote! {
impl #cls {
#[allow(non_snake_case)]
unsafe fn #wrapper_ident(
py: #pyo3_path::Python,
_raw_slf: *mut #pyo3_path::ffi::PyObject,
Expand Down
2 changes: 1 addition & 1 deletion pyo3-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ fn pyclass_impl(
mut ast: syn::ItemStruct,
methods_type: PyClassMethodsType,
) -> TokenStream {
let args = parse_macro_input!(attrs with PyClassArgs::parse_stuct_args);
let args = parse_macro_input!(attrs with PyClassArgs::parse_struct_args);
let expanded = build_py_class(&mut ast, args, methods_type).unwrap_or_compile_error();

quote!(
Expand Down
Loading