Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declarative modules submodules don't work with #[pyo3::prelude::pymodule] #4285

Closed
alex opened this issue Jun 25, 2024 · 2 comments · Fixed by #4288
Closed

Declarative modules submodules don't work with #[pyo3::prelude::pymodule] #4285

alex opened this issue Jun 25, 2024 · 2 comments · Fixed by #4288

Comments

@alex
Copy link
Contributor

alex commented Jun 25, 2024

pyca/cryptography avoids using the prelude, and instead references things with their full name.

This does not work with declarative modules's submodules:

#[pyo3::prelude::pymodule]
mod foo {
    // `submod` won't actually be registered!
    #[pyo3::prelude::pymodule]
    mod submod {}
}

This is because we specifically look for #[pymodule], but don't allow the full name: https://github.com/PyO3/pyo3/blob/main/pyo3-macros-backend/src/module.rs#L213

We should allow the full name to work.

alex added a commit to alex/pyo3 that referenced this issue Jun 26, 2024
alex added a commit to alex/pyo3 that referenced this issue Jun 26, 2024
alex added a commit to alex/pyo3 that referenced this issue Jun 26, 2024
alex added a commit to alex/pyo3 that referenced this issue Jun 26, 2024
alex added a commit to alex/pyo3 that referenced this issue Jun 26, 2024
alex added a commit to alex/pyo3 that referenced this issue Jun 26, 2024
alex added a commit to alex/pyo3 that referenced this issue Jul 2, 2024
alex added a commit to alex/pyo3 that referenced this issue Jul 2, 2024
@styvane
Copy link
Contributor

styvane commented Jul 4, 2024

Functions are also not registered when using the full path

@alex
Copy link
Contributor Author

alex commented Jul 4, 2024

The PR resolves that as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants