Fixed scoping bug in pyobject_native_type that would break rust-numpy
This commit is contained in:
parent
d59bebcc38
commit
7d4381fc5d
|
@ -1,6 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## 0.3.0 (unreleased)
|
||||
## 0.3.1
|
||||
|
||||
* Fixed scoping bug in pyobject_native_type that would break rust-numpy
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* Upgraded to syn 0.14 which means much better error messages :tada:
|
||||
* 128 bit integer support by [kngwyu](https://github.com/kngwyu) ([#137](https://github.com/PyO3/pyo3/pull/173))
|
||||
|
|
|
@ -44,7 +44,7 @@ macro_rules! pyobject_downcast(
|
|||
{
|
||||
unsafe {
|
||||
if $checkfunction(ob.as_ptr()) != 0 {
|
||||
Ok(&*(ob as *const $crate::objects::PyObjectRef as *const $name))
|
||||
Ok(&*(ob as *const $crate::PyObjectRef as *const $name))
|
||||
} else {
|
||||
Err($crate::PyDowncastError.into())
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ macro_rules! pyobject_native_type_named(
|
|||
impl ::std::convert::AsRef<$crate::PyObjectRef> for $name {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(useless_transmute))]
|
||||
fn as_ref(&self) -> &$crate::PyObjectRef {
|
||||
unsafe{&*(self as *const $name as *const $crate::objects::PyObjectRef)}
|
||||
unsafe{&*(self as *const $name as *const $crate::PyObjectRef)}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ macro_rules! pyobject_native_type(
|
|||
|
||||
impl<'a> ::std::convert::From<&'a $name> for &'a $crate::PyObjectRef {
|
||||
fn from(ob: &'a $name) -> Self {
|
||||
unsafe{&*(ob as *const $name as *const $crate::objects::PyObjectRef)}
|
||||
unsafe{&*(ob as *const $name as *const $crate::PyObjectRef)}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue