add Bound API constructors from borrowed pointers#3858
Merged
davidhewitt merged 4 commits intoPyO3:mainfrom Feb 18, 2024
Merged
add Bound API constructors from borrowed pointers#3858davidhewitt merged 4 commits intoPyO3:mainfrom
davidhewitt merged 4 commits intoPyO3:mainfrom
Conversation
CodSpeed Performance ReportMerging #3858 will degrade performances by 20.41%Comparing Summary
Benchmarks breakdown
|
Icxolu
approved these changes
Feb 18, 2024
src/instance.rs
Outdated
| } | ||
|
|
||
| impl<'a, 'py> Borrowed<'a, 'py, PyAny> { | ||
| /// Constructs a new `Borrowed<'py, PyAny>` from a pointer. Panics if `ptr` is null. |
Member
There was a problem hiding this comment.
Suggested change
| /// Constructs a new `Borrowed<'py, PyAny>` from a pointer. Panics if `ptr` is null. | |
| /// Constructs a new `Borrowed<'a, 'py, PyAny>` from a pointer. Returns an `Err` by calling `PyErr::fetch` | |
| /// if `ptr` is null. |
Missing lifetime here, same for the others. Also you mixed the or_err and panicking variants
Member
Author
There was a problem hiding this comment.
Good catch. I think I got mixed up because the functions aren't in the same order as for Bound - I'll swap them so that from_ptr is first at the same time 👍
Member
Author
|
Thanks for the review, will try to fixup tonight 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As per #3708 (comment)
I decided to add both
Bound::from_borrowed_ptrandBorrowed::from_ptrsets of methods. I think theBoundmethods make sense from a consistency withPyangle and also for simplicity. TheBorrowedmethods may be useful in extreme cases for power users, and also are what I'd like to use internally in #3708