-
Notifications
You must be signed in to change notification settings - Fork 763
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
Improve default value for None
in text_signature
#3066
Conversation
795afa0
to
a4a58f5
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.
Thanks!
I think there's another test case to consider, which is what happens if the argument is implicitly defaulted to None
, as per https://pyo3.rs/v0.18.2/function/signature#trailing-optional-arguments
i.e. this test case:
#[pyfunction]
fn increment(x: u64, amount: Option<u64>) -> u64 {
x + amount.unwrap_or(1)
}
should have __text_signature__ == (x, amount=None)
a4a58f5
to
672f893
Compare
Thanks for the review, I think I've addressed it now. |
672f893
to
57dbc94
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.
Thanks, looks great, sorry I missed your reply earlier!
bors r+
bors r- |
Canceled. |
bors r+ |
(whoops, looks like bors is fine and I just hadn't noticed another batch is already merging, sorry for the spam 😅) |
Build succeeded: |
xref #2863