Skip to content

Commit

Permalink
Make more clear references to PyO3#1709
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Jul 20, 2021
1 parent fdbd0f9 commit 5d900f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ We use lots of code blocks in our docs. Run `cargo test --doc` when making chang
the doctests still work, or `cargo test` to run all the tests including doctests. See
https://doc.rust-lang.org/rustdoc/documentation-tests.html for a guide on doctests.


#### Building the guide

You can preview the user guide by building it locally with `mdbook`.
Expand Down
12 changes: 6 additions & 6 deletions guide/src/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ print(my_extension.__doc__)
For most projects, it's adequate to centralize all your FFI code into a single Rust module.

However, for larger projects, it can be helpful to split your Rust code into several Rust modules to keep your code
readable. Unfortunately, though, some of the macros like `wrap_pyfunction!`
[do not yet work](https://github.com/PyO3/pyo3/issues/1709) when used on code defined in other
modules. One way to work around this is to pass references to the `PyModule` so that each module registers its own
FFI code. For example:
readable. Unfortunately, though, some of the macros like `wrap_pyfunction!` do not yet work when used on code defined
in other modules ([#1709](https://github.com/PyO3/pyo3/issues/1709)). One way to work around this is to pass
references to the `PyModule` so that each module registers its own FFI code. For example:

```rust
// src/lib.rs
Expand Down Expand Up @@ -114,7 +113,8 @@ fn determine_current_os() -> String {
# }
```

Another workaround for splitting FFI code across multiple modules is to add `use module::*`, like this:
Another workaround for splitting FFI code across multiple modules ([#1709](https://github.com/PyO3/pyo3/issues/1709))
is to add `use module::*`, like this:

```rust
// src/lib.rs
Expand All @@ -141,7 +141,7 @@ pub(crate) fn determine_current_os() -> String {
## Python submodules

You can create a module hierarchy within a single extension module by using
[`PyModule.add_submodule()`]({#PYO3_DOCS_URL}}/pyo3/prelude/struct.PyModule.html#method.add_submodule).
[`PyModule.add_submodule()`]({{#PYO3_DOCS_URL}}/pyo3/prelude/struct.PyModule.html#method.add_submodule).
For example, you could define the modules `parent_module` and `parent_module.child_module`.

```rust
Expand Down

0 comments on commit 5d900f4

Please sign in to comment.