Merge pull request #2643 from davidhewitt/pymodule-implementation-detail

docs: note that `#[pymodule]` will create hidden module, like `#[pyfunction]`
This commit is contained in:
messense 2022-09-28 00:10:20 +08:00 committed by GitHub
commit da989ecd3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,11 @@ use syn::{parse::Nothing, parse_macro_input};
///
/// For more on creating Python modules see the [module section of the guide][1].
///
/// Due to technical limitations on how `#[pymodule]` is implemented, a function marked
/// `#[pymodule]` cannot have a module with the same name in the same scope. (The
/// `#[pymodule]` implementation generates a hidden module with the same name containing
/// metadata about the module, which is used by `wrap_pymodule!`).
///
/// [1]: https://pyo3.rs/latest/module.html
#[proc_macro_attribute]
pub fn pymodule(args: TokenStream, input: TokenStream) -> TokenStream {