-
Notifications
You must be signed in to change notification settings - Fork 805
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
Get all the tests building and passing! #1189
Conversation
de4e521
to
7920d2f
Compare
I think I've resolved the doctest issue. |
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.
I took a look at this, I'm not deep into the topic, so most of the comments are superficial or aimed at legibility etc.
@@ -249,7 +249,7 @@ impl<'a> Container<'a> { | |||
let self_ty = &self.path; | |||
let mut fields: Punctuated<TokenStream, syn::Token![,]> = Punctuated::new(); | |||
for i in 0..len { | |||
fields.push(quote!(slice[#i].extract()?)); | |||
fields.push(quote!(s.get_item(#i).extract()?)); |
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.
Is the memory layout different for PyTuple
s with limited ABI? I know this change here is necessary because as_slice()
is no longer available on PyTuple
:
Lines 84 to 93 in 2ec1c3b
#[cfg(not(Py_LIMITED_API))] | |
pub fn as_slice(&self) -> &[&PyAny] { | |
// This is safe because &PyAny has the same memory layout as *mut ffi::PyObject, | |
// and because tuples are immutable. | |
unsafe { | |
let ptr = self.as_ptr() as *mut ffi::PyTupleObject; | |
let slice = slice::from_raw_parts((*ptr).ob_item.as_ptr(), self.len()); | |
&*(slice as *const [*mut ffi::PyObject] as *const [&PyAny]) | |
} | |
} |
It probably won't have a measurable impact anyways, just curious..
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.
They can be, which is the whole point of the limited ABI :-)
Just a note that this PR includes #1188 so it's probably better to review that one first. |
I moved the applicable comments to #1188 and deleted them in this PR. There's still a question based on changes in this PR. The actual changes that make the change in this PR necessary happened earlier and are already merged in the abi3 branch, so I think this is the correct place to discuss it. |
7920d2f
to
ba10560
Compare
Ok, rebased and ready to go! |
@@ -271,7 +271,7 @@ You can also inherit native types such as `PyDict`, if they implement | |||
However, because of some technical problems, we don't currently provide safe upcasting methods for types | |||
that inherit native types. Even in such cases, you can unsafely get a base class by raw pointer conversion. | |||
|
|||
```rust | |||
```rust,no_run |
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.
What is the problem with this?
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.
subclasses a builtin type which isn't support on abi3 (and I don't know how to make a doc test no_run
only in some cfgs)
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.
OK, though I'll have to modify this when it is changed to raise a compile error.
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!
This incorporates #1188, so I'll rebase it once that merges.