-
-
Notifications
You must be signed in to change notification settings - Fork 640
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
PyO3: upgrade to v0.23.x #21657
PyO3: upgrade to v0.23.x #21657
Conversation
|
574d2bb
to
c0bc113
Compare
c0bc113
to
0266d1c
Compare
The commits each have a distinct change and can be reviewed individually. |
(Just checking that the "[WIP]" in the PR title is no longer true? this is complete?) |
ah yeah, it is no longer WIP. Will edit. |
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, thanks for breaking up the commits.
Only question: with the newly fallible tuple constructor, do we know in what cases it might fail?
Just wondering if some more of them may count as fatal errors (i.e. use .expect(...)
or panic!()
more), or be normal/likely-to-occur and thus be worth wrapping in more context to make debugging easier?
I don't know when it is ever expected to fail. I want to say that "regular" Python and Rust std types are not expected to fail in practice, but I can't point to anywhere supporting that position. The migration guide just notes that "conversions can now return an error." And |
I'm going to land this; if need be, subsequent PRs can improve on how to handle PyTuple::new being able to fail. |
Thanks for the links, digging through into the source code suggests the fallibility is from So, I reckon what you've got here is perfectly fine 👍 |
Upgrade to v0.23.x of the
pyo3
crate:Functions in PyO3 with
_bound
suffixes existed in PyO3 only for easing migration to theBound
API. They are deprecated now and new methods without the_bound
suffixes have been re-introduced in PyO3. This PR renames call sites accordingly and updates code to also reflect that some of the new APIs (e.g.,PyTuple::new
) are now fallible.The
IntoPy
andToPyObject
traits are deprecated in favor of the newIntoPyObject
trait (which is fallible). To ease migration, this PR only disables deprecation warnings as errors in the affected files. (Unfortunately,IntoPyObject
was not introduced in the current v0.22.x version and so we cannot migrate ahead of the upgrade (unlike what was done in useGILProtected
to synchronize access to variouspyclass
types #21670 for the newpyclass
Sync requirement).) Migration will take place in follow-on PRs.IntoPyObject
for&Value
to support some existing call sites.