Merge pull request #1228 from PyO3/exclude-py-coversion
Move impl From for Py<T> to macros not used in rust-numpy
This commit is contained in:
commit
1749747ad4
|
@ -72,15 +72,6 @@ macro_rules! pyobject_native_type_named (
|
|||
unsafe { $crate::Py::from_borrowed_ptr(py, self.as_ptr()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<$($type_param,)*> From<&'_ $name> for $crate::Py<$name> {
|
||||
#[inline]
|
||||
fn from(other: &$name) -> Self {
|
||||
use $crate::AsPyPointer;
|
||||
use $crate::PyNativeType;
|
||||
unsafe { $crate::Py::from_borrowed_ptr(other.py(), other.as_ptr()) }
|
||||
}
|
||||
}
|
||||
};
|
||||
);
|
||||
|
||||
|
@ -97,6 +88,18 @@ macro_rules! pyobject_native_type_core {
|
|||
unsafe{&*(ob as *const $name as *const $crate::PyAny)}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: Rust>=1.40 allows this impl for rust-numpy.
|
||||
// So we should move this to `named` or `convert` when we bump MSRV.
|
||||
impl<$($type_param,)*> From<&'_ $name> for $crate::Py<$name> {
|
||||
#[inline]
|
||||
fn from(other: &$name) -> Self {
|
||||
use $crate::AsPyPointer;
|
||||
use $crate::PyNativeType;
|
||||
unsafe { $crate::Py::from_borrowed_ptr(other.py(), other.as_ptr()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue