Skip to content

Commit

Permalink
Automatically treat nested modules as submodules
Browse files Browse the repository at this point in the history
fixes #4286
  • Loading branch information
alex committed Jul 2, 2024
1 parent ee9123a commit ce53a90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pyo3-macros-backend/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ pub fn pymodule_module_impl(
)? {
set_module_attribute(&mut item_mod.attrs, &full_name);
}
item_mod.attrs.push(parse_quote!(#[pyo3(submodule)]));
}
}
Item::ForeignMod(item) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_declarative_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ mod declarative_module {
}
}

#[pymodule(submodule)]
#[pymodule]
#[pyo3(module = "custom_root")]
mod inner_custom_root {
use super::*;
Expand Down

0 comments on commit ce53a90

Please sign in to comment.