Skip to content

Commit c1f6d4e

Browse files
authored
#[pymodule] doc: focus on the new module usage (#5914)
1 parent 07ccfde commit c1f6d4e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pyo3-macros/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ use syn::{parse_macro_input, Item};
1414

1515
/// A proc macro used to implement Python modules.
1616
///
17-
/// The name of the module will be taken from the function name, unless `#[pyo3(name = "my_name")]`
18-
/// is also annotated on the function to override the name. **Important**: the module name should
17+
/// The name of the module will be taken from the module name, unless `#[pyo3(name = "my_name")]`
18+
/// is also annotated on the module to override the name. **Important**: the module name should
1919
/// match the `lib.name` setting in `Cargo.toml`, so that Python is able to import the module
2020
/// without needing a custom import loader.
2121
///
22-
/// Functions annotated with `#[pymodule]` can also be annotated with the following:
22+
/// Modules annotated with `#[pymodule]` can also be annotated with the following:
2323
///
2424
/// | Annotation | Description |
2525
/// | :- | :- |
@@ -31,7 +31,8 @@ use syn::{parse_macro_input, Item};
3131
///
3232
/// For more on creating Python modules see the [module section of the guide][1].
3333
///
34-
/// Due to technical limitations on how `#[pymodule]` is implemented, a function marked
34+
/// It is also possible to use this macro on functions but this is a deprecated usage. In this case,
35+
/// due to technical limitations on how `#[pymodule]` is implemented, a function marked
3536
/// `#[pymodule]` cannot have a module with the same name in the same scope. (The
3637
/// `#[pymodule]` implementation generates a hidden module with the same name containing
3738
/// metadata about the module, which is used by `wrap_pymodule!`).

0 commit comments

Comments
 (0)