-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically treat nested modules as submodules
fixes PyO3#4286
- Loading branch information
Showing
6 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Nested declarative `#[pymodule]` are automatically treated as submodules (no `PyInit_` entrypoint is created) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#[pyo3::pymodule] | ||
mod mymodule { | ||
#[pyo3::pymodule(submodule)] | ||
mod submod {} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: `submodule` may only be specified once (it is implicitly always specified for nested modules) | ||
--> tests/ui/duplicate_pymodule_submodule.rs:4:2 | ||
| | ||
4 | mod submod {} | ||
| ^^^ | ||
|
||
error[E0433]: failed to resolve: use of undeclared crate or module `submod` | ||
--> tests/ui/duplicate_pymodule_submodule.rs:4:6 | ||
| | ||
4 | mod submod {} | ||
| ^^^^^^ use of undeclared crate or module `submod` |