Skip to content

Commit

Permalink
Properly fails on functions inside of declarative modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpt committed Feb 23, 2024
1 parent beb75da commit 391b8f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyo3-macros-backend/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ pub fn pymodule_module_impl(mut module: syn::ItemMod) -> Result<TokenStream> {
ensure_spanned!(pymodule_init.is_none(), item_fn.span() => "only one pymodule_init may be specified");
let ident = &item_fn.sig.ident;
pymodule_init = Some(quote! { #ident(module)?; });
} else {
bail_spanned!(item.span() => "only 'use' statements and and pymodule_init functions are allowed in #[pymodule]")
}
}
item => {
Expand Down

0 comments on commit 391b8f9

Please sign in to comment.