Fix PyLayout and restrict PyRef::as_ref for non-native types#783
Merged
kngwyu merged 3 commits intoPyO3:masterfrom Mar 3, 2020
Merged
Fix PyLayout and restrict PyRef::as_ref for non-native types#783kngwyu merged 3 commits intoPyO3:masterfrom
kngwyu merged 3 commits intoPyO3:masterfrom
Conversation
Member
Author
|
FYI, this is a valid implementation of unsafe fn get_ptr(&self) -> *mut PyAny {
self.py().from_borrowed_ptr(self as *const _ as *mut _) as *const PyAny as *mut _
}... but I'm not sure we should do so. |
bffbdeb to
8244d13
Compare
Member
|
I've had a read through and looks fine. It's a shame to lose the safe API to access the super class. I want to think for a bit longer and see if I can figure out another way to solve this. |
Member
Author
Yeah, but since native type inheritance was broken in PyO3 < 0.9, it's a not breaking change and not very problematic. |
Member
|
Agreed. I suggest we merge this PR to fix the safety issue, and I'll create a separate issue for finding a safe API for upcasting. |
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.
Fix #782.
Simply I make
get_ptra private method ofPyCellInner.This change forbids to get a base object of
#[pyclass(extends=NativeType]style pyclasses.Current
&PyAnystyle API uses mainly a pointer of a pointer as an object handle, and integrates really badly with newPyCell😣