-
Notifications
You must be signed in to change notification settings - Fork 770
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 other Result types in #[pyfunction]
#1118
Conversation
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 have some minor concerns but it looks that it's nicely fixed 👍
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 like this was even easier than expected 😄
As for the guide: maybe in this section for now? https://pyo3.rs/v0.11.1/conversions.html#returning-rust-values-to-python
I plan to make a bunch of PRs to improve the guide soon anyway, so as long as this functionality is mentioned in the guide I'll probably move it around if necessary ;)
Great, I've made all the suggested fixes now, including mentioning this in the docs. |
Thanks, LGTM! Regarding the UI test - I don't think we'll easily improve the error message (that's pretty much part of the compiler), so I'm just going to merge for now and maybe we can improve this later. |
Thanks! I'm glad I could contribute to PyO3. Cheers :) |
Thank you for contributing to pyo3!
Please consider adding the following to your pull request:
Be aware the CI pipeline will check your pull request for the following:
cargo test
ormake test
if you need to test examples)make clippy
)cargo fmt
)black . --check
. You can install black withpip install black
)tox
; you can do run it usingmake test_py
.You can run a similar set of checks as the CI pipeline using
make test
.I've implemented #1106, see that issue for a description. It was quite simple but I haven't touched this codebase before so please let me know if anything can be improved.
I included a couple tests, one where it works correctly, and another where it fails to compile because
from From<MyErr> for PyErr
isn't implemented. What I would like to know before this is merged:tests/ui/invalid_result_conversion.stderr
for the current error message.