-
Notifications
You must be signed in to change notification settings - Fork 760
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
Allow #[pymodule]
functions to take a single module arg
#3905
Conversation
732e890
to
bbf0956
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is something I've wanted for a while. Obviously the first two commits are still being finalised, hopefully they can land soon and then we can get this merged.
tests/test_no_imports.rs
Outdated
@@ -22,6 +22,21 @@ fn basic_module(_py: pyo3::Python<'_>, m: &pyo3::types::PyModule) -> pyo3::PyRes | |||
Ok(()) | |||
} | |||
|
|||
#[pyo3::pymodule] | |||
fn basic_module_bound( | |||
_py: pyo3::Python<'_>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this meant to take just a single argument?
_py: pyo3::Python<'_>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed.
Also, maybe in this PR let's update documentation to use this new one-argument form. (Or is that better for a follow up due to conflicts?) I think this form is strictly better and closer to what we'll eventually move to in #3900 |
I have changed the documentation to this one-arg form in #3899 which deprecates the |
Aha fab, I confess I'd not read that PR yet. Fine to leave there 👍 |
0c32203
to
bb00be8
Compare
Rebased now that #3897 is in. @davidhewitt, please take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks again! 🚀
After #3897. This was split off from #3899 and contains just the changes to the
#[pymodule]
macro.