diff --git a/src/types/mod.rs b/src/types/mod.rs index b3915a8f..3cccd86e 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -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()) } + } + } } }